11148 - I2P(I)2016_Yang_mid1_practice5   

Description

In the beginning of this year, Wooder creates a bank account which pays 0.6% interest per year, compounded yearly. Then, Wooder may deposit or withdraw some amount of money in the beginning of each of the following years. You are asked to help calculate the amount of money in Wooder’s bank account.

Consider the following example:

  • In the beginning of year 1, the account balance is 500.00.
  • In the beginning of year 2, the account balance is (500*1.006) + 100=603.00.
  • In the beginning of year 4, the account balance is (603*1.0062) - 450=160.26.
  • To accumulate Wooder’s account in the beginning of year 7, we can report that the total amount of money is 160.26*1.0063=163.16.l  

Input

The input contains several lines. Each line contains three elements, which are separated by blanks, describing the bank transaction at a specific year:

  • The first element indicates the year.
  • The second element indicates deposit (D), withdraw (W) or accumulate the account (A).
  • The third element indicates the amount of money when depositing or withdrawing.

Note that 0 < year < 100, and 0 <= money <= 1000.

When your program reads in an “accumulate” (A) instruction, it will output the balance of Wooder’s bank account at the beginning of the indicated year. Then your program is terminated

Output

The amount of money in Wooder’s bank account.
The answer should be expressed as a floating point number with precision to the second decimal place. Note that you need to print a ' \n' at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss