#P1968. 美元汇率

美元汇率

Description

In the coming days, David will study the exchange rate between the US dollar and the Deutsche Mark. Write a program to help David decide when he should buy or sell marks or dollars so that, starting from 100100 dollars, he can end up with the highest possible value.

Input Format

The first line of the input file contains a natural number NN, 1N1001 \le N \le 100, which is the number of days David studies the exchange rate.

Each of the next NN lines contains a natural number AA, 1A10001 \le A \le 1000. The AA on line i+1i+1 gives the known average exchange rate for day i+1i+1: on that day, David can use 100100 dollars to buy AA marks, and he can also use AA marks to buy 100100 dollars.

Output Format

Output a single line with the required amount of money (in dollars), rounded to two decimal places.

Note: Considering rounding errors in real-number arithmetic, any result within 0.050.05 dollars of the correct answer is accepted. David must convert all his money back to dollars before the end of the last day.

5
400
300
500
300
250
266.67

Hint

Sample explanation

Day 1 ... changing 100.0000 USD= 400.0000 Mark
Day 2 ... changing 400.0000 Mark= 133.3333 USD
Day 3 ... changing 133.3333 USD= 666.6666 Mark
Day 5 ... changing 666.6666 Mark= 266.6666 USD

Updated on 2017/08/18:

  1. The correct answer to the sample is 266.67266.67.
  2. Test point 11 has been replaced by the sample.
  3. The SPJ's tolerance used to be 0.010.01; according to the statement, it has been changed to 0.050.05.

Translated by ChatGPT 5