409513: GYM103604 H Magic Powers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Magic Powerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You have a bag of $$$N$$$ cheques of values $$$A_1$$$, $$$A_2$$$, ..., $$$A_N$$$ dollars. You just met your old magician friend who has some special magical powers. By just waving his wand, two cheques from the bag are removed uniformly at random. In their place, a new cheque is added with a value equal to their sum. Moreover, you receive an amount of money equal to the value of the new cheque. Your friend is doing this until there is only one cheque left in the bag. To thank your friend, you give him the last cheque.

What is the expected value of the total amount of money you receive from the magic trick?

Input

The first line of the input contains the integer $$$N$$$ ($$$2 \leq N \leq 500$$$), denoting the number of cheques.

The second line of the input contains $$$N$$$ integers $$$A_1$$$, $$$A_2$$$, ..., $$$A_N$$$ ($$$1 \leq A_i \leq 10^9$$$), denoting the value of each cheque.

Output

On a single line, print the expected value of the total amount of money you receive thanks to your friend's magic trick. Your answer is considered correct if at least one of the absolute difference or the relative difference between your answer and judge's answer is less or equal than $$$10^{-6}$$$.

ExampleInput
5
3 1 2 6 3
Output
38.5000000000

加入题单

算法标签: