Deposit "Anti-crisis"#634

Deposit "Anti-crisis"

2 seconds
64 megabytes
Easy

Permanent clients of a very large bank have recently been offered the opportunity to open a new account called "Anti-Crisis". This account features a complex interest calculation scheme, and as the sole employee of the bank's IT department, you are tasked with developing a program to compute the account balance with accrued interest.

The "Anti-Crisis" account can be opened for any term, but the account's end date must be no later than December 31, 2009. The interest rate on the account is percent per annum. This means that if at the start of a certain period of days, during which the account balance remains unchanged, the balance was units, then at the end of this period it will be x \cdot \left( 1 + \frac{p}{100} \cdot \frac{d}{365} \right ).

Interest is accrued monthly on the last day of the month (or on the last day of the account's term), and this interest is added to the account balance. For example, if on May 1 the account balance was units, then on May 31, x \cdot \frac{p}{100} \cdot \frac{31}{365} units will be added to the account, and on June 1 the balance will be x \cdot \left( 1 + \frac{p}{100} \cdot \frac{31}{365} \right ). In June, interest will be calculated on this new amount.

If the account's last day was May 20, then on that day, x \cdot \frac{p}{100} \cdot \frac{20}{365} units will be added to the account, and the balance that the client will receive will be x \cdot \left( 1 + \frac{p}{100} \cdot \frac{20}{365} \right ). Similar calculations apply if the account was opened not on the first day of the month. For instance, if the account was opened on February 18, then on February 28, x \cdot \frac{p}{100} \cdot \frac{11}{365} units will be added to the balance, and if it was opened on February 28, then on that same day, x \cdot \frac{p}{100} \cdot \frac{1}{365} units will be added.

Your task is to write a program that, given the account opening date and its term, calculates what the account balance will be at the end of the term, starting with an initial amount of units.

Input

The first line of the input file contains three integers: the initial account balance , the interest rate , and the account duration (1 \leq x \leq 100000, 1 \leq p \leq 200, 1 \leq d \leq 365). The second line of the input file contains the account opening date in the format "day-month-year". The day and month are represented by numbers, with leading zeros for numbers less than ten. It is guaranteed that the account is opened in , and its end date is also in .

Output

Output the final account balance with a precision of decimal places.

Examples

Example 1

Loading
Loading