#P47. [KBC003G] Triangle 2

[KBC003G] Triangle 2

Source

This problem is adapted from Long Long OJ. All rights reserved.

Problem Description

Given nn sticks, select 3 of them to form a triangle, then select another 3 distinct sticks to form a second triangle. Find the maximum sum of the perimeters of these two triangles.

It is guaranteed that a calculation error within 10410^{-4} will not lead to a wrong answer.

Three sticks can only form a triangle if they are connected end to end in sequence.

For a valid triangle, the sum of the lengths of any two sides must be greater than the length of the third side.

Input Format

The first line contains a positive integer n (1n220)n\ (1 \le n \le 2^{20}), representing the numbers of sticks.

The second line contains nn floating-point numbers $a_1, a_2, \ldots, a_n\ \ (1 \le a_i \le 1.875 \times 10^{12})$, representing the lengths of the sticks.

Output Format

Output a single floating-point number, representing the maximum sum of the perimeters of the two triangles.

Your answer must have an absolute or relative error within 10410^{-4}.

If no valid solution exists, output 1-1.

Samples

6
1.123 2.234 3.345 4.456 5.567 6.678
23.403
1
123.456
-1