The payout of the game is then the average value of the counted cards. That is, it is the sum of the counted cards divided by the number of counted cards. If there are no counted cards, the payout is 0.
You have an 'in' with the dealer, and you know the full deck in order ahead of time. What is the maximum payout you can achieve?
The first line of the input contains a single integer, the number of cards in the deck.
The second line of input contains
space-separated integers, the values on the cards. The value of each card is in the range
. The cards are dealt in the same order they are given in the input.
Output the largest attainable payout. The answer is considered correct if the absolute error is less than, or the relative error is less than
.
In the first sample, by calling "Stop Counting!" before theand "Start Counting!" before the final
, we can achieve an average of
with the cards that are counted.
In the second sample, all values are negative, so the best strategy is to call "Stop Counting!" before the first card is dealt and call "Start Counting!" after the last card is dealt. Since no cards were counted, the average of the counted cards is
.