#question 5

money = int(input("How many dollars are you investing?\n"))
numYears = int(input("How many years will you invest?\n"))

for i in range(numYears):
    if (money - 500)*1.5 > (money - 1000)*2:
        money =  (money - 500)*1.5
    else:
        money = (money - 1000)*2

print(money)
