Triangle
InterviewTime limit3sMemory limit512 MB
Given N stick lengths, pick six to form two non-degenerate triangles and print the maximum total length, or 0 if that is impossible.
Problem
There are sticks. The length of the -th stick is . Choose six sticks and build two triangles. Each chosen stick must be used as an edge of one of the triangles, and both triangles must be non-degenerate (have positive area). Compute the maximum possible total length of the six chosen sticks. If two triangles cannot be built this way, the answer is 0.
Input
The first line contains an integer (). Each of the next lines contains an integer ().
Output
Print the answer.