Seats

아직 제출이 없습니다시간 제한1.5초메모리 제한256 MB

문제

In the game of Seats there are nn seats and nn players. The ii-th seat initially contains a prize of a_ia\_i dollars. The prize is meant to be collected by the player that will manage to take the ii-th seat.

Before the game starts, each player chooses a single seat they would like to sit on. When the game starts, all players run toward their chosen seats and fight for it.  We assume that all the players fighting for some seat are equally likely to sit down on that chair and collect the prize. After the fight, exactly one of these players will manage to take that seat. The players that fail to take their chosen seat gain nothing.

Suppose all the players choose their seat by sampling it from some fixed probability distribution that is identical for all players. What is the maximum expected prize of a player if the distribution is chosen optimally?

Consider the following example. Let n=2n=2, a_1=1a\_1=1 and a_2=2a\_2=2. If all players decide to go for the "more profitable" seat 22 with probability 11, the expected prize for each of them will be 122=1\frac{1}{2}\cdot 2=1 dollar. However, if the seats 11 and 22 are assigned probabilities 13\frac{1}{3} and 23\frac{2}{3} respectively, each player will gain 76\frac{7}{6} dollars in expectation.

입력

The first line of the input contains a single integer nn (1n50001\leq n\leq 5000). The second line of the input contains nn integers a_1,,a_na\_1,\ldots,a\_n (1a_i10001\leq a\_i\leq 1000), denoting the prizes assigned to the respective seats.

출력

You should output the expected prize of a single player provided that the probability distribution is chosen optimally. Your answer will be considered correct if its absolute or relative error does not exceed 10710^{-7}.