Reorder N scores around a regular N-gon to maximize the polygon's area.
Medium7SortingGreedyGeometryMathNo attempts yetTime limit2sMemory limit512 MBAlex registered in an online dating system to search for the perfect partner. The system requires each of its members to fill a form specifying how much they enjoy N different activities, grading them on a scale from 0 to 100. To present this information to potential dates, the system creates a profile with a special kind of polygon called a radial diagram.
A radial diagram for N activities is drawn by marking N points on the plane. Starting from the vertical direction, the i-th point in clockwise order represents the i-th activity specified by the member, and it lies at distance Si from the center of the diagram, where Si is the score the member gave to that activity. The angle at the center between every pair of consecutive points is always the same, and the polygon is formed by drawing the segments whose endpoints are consecutive points. In a radial diagram the first and the last point are also considered consecutive.
For example, if N=6 and Alex specifies singing with score S1=10, running with score S2=60, listening to music with score S3=70, traveling with score S4=70, eating out with score S5=80, and visiting museums with score S6=80, then the radial diagram looks like the figure below.

The area of a radial diagram depends on the order in which the activities are specified, and Alex believes that a profile with a larger radial diagram is more successful. The next figure has the same activities and the same scores as the example above, but its area is larger.

Given a list of activities with their scores, write a program that finds the maximum possible area of a radial diagram.
The first line contains the number of activities N (3≤N≤105).
The second line contains the scores S1,S2,…,SN that Alex gave to each activity, separated by spaces (0≤Si≤100).
Print one line with the maximum possible area of a radial diagram built from the scores in the input. Print exactly 3 digits after the decimal point, rounded if necessary.