Look at your code: you're first printing the value and then calculate it. That's why your LP[1] is in fact LP[0].