Triangle
시간 제한3초메모리 제한512 MB
N개의 막대 중 여섯 개를 골라 막대마다 한 번씩만 사용해 두 개의 삼각형을 만들고, 고른 여섯 막대 길이의 합의 최댓값을 구한다.
문제
There are sticks. The length of the -th stick is . You want to choose six sticks and construct two triangles. Each stick should be used as an edge of one of the triangles. Also, the triangles should be non-degenerate.
Compute the maximum possible total length of the six chosen sticks. If two triangles can not be constructed this way, assume the total length is 0.
입력
The first line contains an integer (). The -th of the next lines contains an integer ().
출력
Print the answer.