eolymp
bolt
Try our new interface for solving problems
Problems

Grassland Fence

Grassland Fence

There is a large grassland next to the villa Pemberley in the southern region of Byterland. Mrs. Darcy is afraid of her potted plants being trampled by strangers, so she decides to fence in some triangular areas in the grassland. Mrs. Darcy has several fences in her basement. She will form each triangular area using exactly three fences, such that each side of the triangle is a single fence. Since the fences are beautifully decorated, she will not glue multiple fences together to form a single side, or split a single fence into multiple smaller fences. Her goal is to fence in as large an area as possible. \InputFile Each line is a separate test case. The first number in the line is the amount $n~(n \le 16)$ of Mrs. Darcy's fences. Next $n$ numbers are the lengths of these fences which are the integers between $1$ and $100$. \OutputFile For each test case print in a separate line the maximal area that can be fenced in with $4$ digits after the decimal point. \Examples In the first test, it is preferable to construct triangles with side lengths $(4, 5, 6)$ and $(7, 8, 9)$. The enclosed area will be $36.7544$. In the second test, the answer is $0$ since it is impossible to form any triangle. In the third test, the triangle $(4, 4, 4)$ should be constructed. The lengths of fences can be repeated.
Time limit 1 second
Memory limit 126 MiB
Input example #1
7 3 4 5 6 7 8 9
4 1 2 4 8
4 7 4 4 4
Output example #1
36.7544
0.0000
6.9282