High School Programming League 2011/2012

Another Investment

Problem code: HS11INV2

In n successive years Robert made n investments, one per year. Now, he would like to verify how effective his investments were and to calculate the annualized rate of return for them.

Input

The first line of input contains one integer 1< n <10 - the number of years to be considered.

In the next n lines you are given the amount (with two digits of precision) of Robert's investment in each of the consecutive years – one amount in each line.

The last line contains one number: Y>0 - the total value of all of Robert's investments after n years, with two digits of precision.

Output

Output the internal rate of return (IRR), assuming that annual investment period lengths were equal, as a percentage value with two digits of precision.

Example 1

Input:
4
1000.00
1000.00
1000.00
1000.00
7000.00

Output:
23.69

Example 2

Input:
3
3
2
2
3

Output:
-34.63


Scoring

By solving this problem you score 10 points.


Added by:Łukasz Kuszner
Date:2011-09-05
Time limit:1s
Source limit:50000B
Languages:All except: SED AWK
Resource:High School Programming League
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.