Passbook Withdrawal
Xem dạng PDFNam has a passbook (sổ tiết kiệm) of X VND with an interest rate of r1% per year and a term of n months. Interest is calculated at the end of the term. After m months (m < n), Nam wants to withdraw money from the passbook to build a house. After researching, Nam has discovered two options:
Option 1: settle the passbook and receive only the full principal amount.
Option 2: Use the passbook as collateral (passbook loan) to borrow money from a bank with a value of Y VND and an interest rate of r2% per year. Interest is calculated annually (if n – m ≥ 12), or until the passbook is settled at month n. Note that in this case, Nam will use all amount of money he receives from his passbook after month n to pay off this loan.
Calculate the maximum amount of money Nam can withdraw from the passbook (X) or borrow from the bank (Y).
Input
The only line contains 3 integers X, n and m, followed by 2 real numbers r1 and r2 (0 < X ≤ 10^15, 0 < m < n ≤ 300, 0 < r1, r2 ≤ 20).
Output
The maximum amount of money (rounded to unit).
Example
Input
100000000 12 10 7 8.5
Output
105505341
Input
100000000 12 2 7 8.5
Output
100000000
Bình luận