All problems

Compounding a Growth Rate

mediumPythonNumPyElement-wise

Halcyon Bank's savings product pays a fixed rate once a day, and the interest earned stays in the account — so the next day's interest is worked out on the larger balance, not on the original deposit. A planning screen shows a customer what one opening deposit turns into after several different waiting times, side by side, so that the value of waiting longer is visible at a glance.

Task: Print the balance after each of the waiting times given.

Input

Three lines. The first holds the opening deposit and the daily rate, separated by a single space; the rate is written as a fraction, so 0.1 means 10 percent a day. The second holds n, how many waiting times are on the screen. The third holds those n day counts on one line, separated by single spaces; each is a whole number and may be 0.

Output

One line holding n balances, in the order the day counts were given, separated by single spaces, each with two digits after the decimal point. A wait of 0 days leaves the deposit exactly as it was.

Example:

Input:
100 0.1
3
0 1 2

Output:
100.00 110.00 121.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…