Purchase on credit
The bank offers a loan for purchasing a product with the following terms. If you buy a product worth S
on credit for N
months, your initial payment will be S
/N
. This is followed by monthly payments of S
/N
for the next N
−1 months. At the end of the N
months, you must pay the accumulated interest for using the credit, which is calculated as follows:
For the first month, the interest is
P
·(N−1)·S
/N
.For the second month, the interest is calculated on the remaining unpaid value of the product as
P
·(N
−2)·S
/N
, plus interest on the previous month's interest, which isP
·P
·(N
−1)·S
/N
.This pattern continues for each subsequent month.
Write a program to calculate the amount of the final payment.
Input
The first line of the input contains three numbers separated by spaces: the purchase price S
(an integer, 0 < S
< 10^9
), the number of months N
(an integer, 0 < N
< 100), and the interest rate P
(a real number, 0 < P
≤ 0.01
).
Output
Output the amount of the final payment, rounded to a precision of 10−2.