Jacob has saved up some extra money, and is looking to invest. The banks in
his area offer a variety of options for savings bonds, each with an interest rate and
compounding period. Jacob would open an account with some initial principal amount of
money P, and then at every compounding period the amount in the account would increase by
the interest rate.
For example, if Jacob places $200 into an account with
a 10% interest rate and compounding period of 1 year, then at the end of the
year he will end up with $220. However if he instead places that $200 into an
account with a 5% interest rated compounded every 6 months then at the end of
the year he will have $220.5. That is, at the end of the first 6 month period he will
increase his account balance from $200 to $210, and then after another 6 month
period the balance will increase from $210 to $220.5.
| Compounding Intervals Elapsed |
Account Value |
|---|---|
| 0 | 200 |
| 1 | 210 |
| 2 | 220.5 |
| 3 | 231.525 |
| 4 | 255.256313 |
| 5 | 268.019128 |
The value of an account with P = $200 and I = 5% after multiple compounding events.
Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each with three space-separated values in the format
P I C with P being the principal amount used to open the account, I being
the interest rate expressed as a decimal (for example 50% would be expressed
as 0.5), and C being the quantity of compounding periods in a single year.
Answer
Should consist of Q space-separated values, corresponding to the amount of
money in each account after 1 year.
Error should be less than 1e-6.
Example
input data:
3
200 0.1 1
200 0.05 2
123.45 0.012 12
answer:
220 220.5 142.448291