Manisha is a smart investor. She has opened a Recurring Deposit (RD) account with a bank. She has negotiated smartly with the bank. Bank has agreed to vary the interest rate on her RD account such that she is always able to comfortably beat inflation.
Your task is to calculate maturity value of her RD account in face of varying interest rates that she will enjoy.
First line contains principle amount P
Second line contains original rate of interest per annum R
Third line contains tenure in months T
Next few lines contain a tuple with 3 values. Each tuple contains delimited by whitespace, where updated _rate is applied on From_month and To_month, both inclusive. -1 shows the end of input
Print the maturity amount after specified tenure or month in the format "Final_Amount "
P > 0 ; it can be float value
R >=0 ; it can be float value
T >0 ; it can be integer only
Calculation should be done upto 11-digit precision
Maturity amount should be printed to its nearest integer value