Hide

Problem E
Estimated Endowment Elderliness

After certain customer laws went into effect, all banks in Norway are now required to send you a transparent report on your fund accounts and the costs associated with them. Claudia was rather surprised when she got a letter from Euler Bank, telling her about a fund account named “For Dog” she didn’t know she had!

After some digging around, she found out her grandparents put a lump sum into a fund in her name a long time ago. When Claudia was young, she really wanted a dog, and her grandparent thought it made sense to save up some money in a fund until she could take care of one herself. However, the age of the fund account is not present in the account report, and her grandparents don’t remember exactly when they bought the fund shares.

The fund is one of the weirder ones over at Euler Bank: Its price is always monotonically increasing or decreasing during a month! Because her grandparent put in a lump sum and the capital has been in the same fund since it was bought, Claudia figures she can compute which month they bought the fund shares.

Euler Bank provides monthly rate of returns for all their funds, dating back to the fund’s inception. A monthly rate of return $r_ i$ is defined as

\begin{align*} r_ i & = \cfrac {C_ i - C_{i-1}}{C_{i-1}} \\ C_ i & = \text {closing price on last day of month } i \end{align*}

For example, if $r_ i = 1.23\% $ for February, then if Claudia had $100.00$ NOK in the fund at the end of January, she would’ve had $101.23$ NOK at the end of February. And if $r_ i = -2.34\% $, she would’ve had $97.66$ NOK instead.

The fund report tells Claudia, among other things, the total rate of return $R_ N$ for her fund shares. Can you help Claudia figure out how long ago the fund shares were bought?

Input

The first line contains an integer $N$ and a percentage $R_{N}$, representing the number of complete months the fund has been available, and the total rate of return of the initial lump sum at the end of last month.

Then follows one line with $N$ percentages $r_ i$, separated by a single whitespace. $r_1$ is the fund’s first monthly return and $r_{N}$ is the monthly rate of return for the last month.

Percentages are written as a real number followed by a percentage sign.

Output

Output the number of years and months since the initial deposit in the format “x year[s] and y month[s] ago” (without the quotation marks).

If there are multiple possible answers, output the answer the furthest back in time. If there are none, output “something fishy is going on” (without the quotation marks).

Limits

  • $0 < N < 250$

  • Percentages in the input will have exactly 2 digits after the decimal point

  • $-50.00\% < r_{i} < 100.00\% $

  • $-100.00\% < R_{N} < 1\, 000.00\% $

  • The total rate of return for the fund account is never in the interval $[-0.01\% , 0.01\% ]$ at the end of a month

Sample Input 1 Sample Output 1
2 10.00%
0.00%
20.00%
0 years and 1 month ago
Sample Input 2 Sample Output 2
5 9.60%
1.41%
1.62%
0.69%
2.72%
3.14%
0 years and 5 months ago
Sample Input 3 Sample Output 3
6 -10.00%
-20.00%
20.00%
-20.00%
20.00%
-20.00%
20.00%
0 years and 6 months ago
Sample Input 4 Sample Output 4
1 999.99%
3.00%
something fishy is going on
Sample Input 5 Sample Output 5
20 14.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1.00%
1 year and 2 months ago

Please log in to submit a solution to this problem

Log in