#t373. 电池的寿命

电池的寿命

Battery Life

Problem Background

Special for beginners, ^_^

Problem Description

Little S bought a handheld game console powered by two AA batteries. To play for as long as possible, he bought many AA batteries. Because they come from different manufacturers with different quality, their lifetimes differ: some last 5 hours, some only 3. Obviously, if he only has two batteries, one lasting 5 hours and one lasting 3, he can only play for 3 hours and one battery's remaining charge is wasted. But with more batteries he can use them more efficiently. For example, with three batteries lasting 3, 3, and 5 hours, he can first use the two 3-hour batteries, after half an hour replace one with the 5-hour battery, two and a half hours later replace the remaining one with the previously removed battery (which still has 2.5 hours), giving a total of 5.5 hours with no waste.

Given the number of batteries and their lifetimes, find a plan that maximizes the total playing time.

Input Format

There are multiple test cases. Each case has two lines: the first line is an integer N (2≤N≤1000)N\ (2\le N\le 1000) — the number of batteries; the next line contains NN positive integers — the lifetimes of the batteries.

Output Format

For each test case, output one line with the total playing time, kept to 1 decimal place.

Sample Input

2
3 5
3
3 3 5

Sample Output

3.0
5.5

Constraints

2≤N≤10002\le N\le 1000.

Time limit 1s, memory limit 1024KiB for each test case.