initialBalance = balance = 999999
annualInterestRate = 0.18
lower = balance /12.0
upper = (balance*(1 + annualInterestRate/12.0)**12)/12

while abs(balance) > 0.01:
    balance = initialBalance
    for i in range(12):
        monthlyPayment = (lower + upper)/2
        Ub = balance - monthlyPayment
        balance = Ub*(1 + annualInterestRate/12.0)
    if balance >= 0:
        lower = monthlyPayment
    else:
        upper = monthlyPayment
print("Lowest payment: ") + str(round(monthlyPayment,2))
print("Remaining balance: ") + str(round(balance,2))