New Year
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
White flies flew in — the whole yard became white... In a word, winter was supposed to come, but for now it is only theoretical. And aren’t we going to celebrate the beginning of the New Year as merrily and carelessly as always? I think we will anyway — our nation is like that, always celebrating... :)
In the snowy yard, the children made, that is, rolled up, many snowballs. And now it’s time to go home. But the children don’t want to leave their incredible snow masterpieces outside. So they decided to take them into the house. Each child’s mother allows them to bring at most one snowball, or a part of it, into the house. Moreover, if some kid takes a larger part home, another one will be offended.
So the children began to think about how to bring the maximum amount of snow to their homes. Moreover, everyone carries one piece of a snowball of the same volume home. Children can divide the snowballs they have at their disposal in any way, but they cannot stick two pieces together (the snow turned out to be very dry).
You need to find the maximum possible total volume of snow that the children can distribute to their homes.
Input
The first line contains two integers \(n\) and \(m\) — the number of children and the number of snowballs.
The next \(m\) lines each contain a single integer \(r_i\) — the radius of the corresponding snowball.
Output
In a single line, print a real number — the maximum possible volume of snow. The answer will be considered correct if the absolute or relative error does not exceed \(10^{-4}\).
Constraints
\(1 \le n, m \le 10^5\),
\(1 \leq r_i \leq 100\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 8 5 1 10 5 9 9 3 5 | 6107.2561185786 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|