# program to calculate credit card debt and how fast one can pay off it. 


original = 1000.00 #original debt
print "original debt:",original
annualRate = float(raw_input("Enter annual interest rate: "))
print "Annual interest rate: ",annualRate
monthlyRate = annualRate/12.0/100.0 #monthly interest rate
payment=float(raw_input("Enter your monthly payment: ")) #your monthly payment

month = 0
debt = original
flag = True  # sentry variable used to determine the while loop condition
total=0.0 #total payment

while flag: #loop until debt is paid off or stops if it cannot be paid off
    interest = debt * monthlyRate
    if interest > payment: # cannot pay off debt
        print "you will neve pay off your debt at this rate!"
        print "you will need to pay at least", int(interest+1),"per month"
        flag=False # stop the loop
    else:
        month=month+1
        debt=debt+interest-payment 
        total=total+payment
        if debt <=0:
            flag=False
            total=total+debt
            debt=0
        print "Month",month," remaining debt is",debt

if interest<=payment:
    print "\nIt will take",month,"months to pay off your debt"
    print "you will pay",total,"in total"

raw_input("\nType enter to exit.")

