What is the formula for calculating the loan balance at the end of the ith month?
B = P * ((1 + r)^n (1 + r)^i) / (r * (1 + r)^n), where B is the loan balance at the end of the ith month, P is the monthly loan payment, r is the monthly interest rate, n is the total number of months of the loan, and i is the number of months elapsed since the loan was originated.