#t358. 美元汇率

美元汇率

Dollar Exchange Rate

Problem Background

(This problem omits the MAX_INT+1 numbers.)

Problem Description

Over the next several days, David will study the exchange rate between the US dollar and the German mark. Write a program to help David decide when to buy or sell marks or dollars, so that starting from $100 he can end up with the highest possible value.

Input Format

The first line of the input file is a natural number N  (1≤N≤100)N\;(1\le N\le 100), the number of days David studies the exchange rate.

The following NN lines each contain a natural number A  (1≤A≤1000)A\;(1\le A\le 1000). The AA in line i+1i+1 is the average exchange rate for day i+1i+1, on which David can either use 100100 dollars to buy AA marks, or use AA marks to buy 100100 dollars.

Output Format

The first and only line of the output file should contain the required amount of money (in dollars, kept to two decimal places).

Note: because of rounding errors in floating-point arithmetic, an answer within 0.050.05 dollars of the correct result is considered correct. David must convert all his money back into dollars before the end of the last day.

Sample Input

5
400
300
500
300
250

Sample Output

266.67

Sample Explanation

Day 1 ... changing 100.0000 dollars = 400.0000 marks
Day 2 ... changing 400.0000 marks = 133.3333 dollars
Day 3 ... changing 133.3333 dollars = 666.6666 marks
Day 5 ... changing 666.6666 marks = 266.6666 dollars

Update on 2017/08/18:

  1. The correct answer for the sample is 266.67266.67.
  2. Test point 11 has been changed to the sample.
  3. The original SPJ tolerance was 0.010.01; according to the problem statement it has been changed back to 0.050.05.