시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB40131339.394%

문제

There are $N$ sticks. The length of the $i$-th stick is $a_i$. 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 $N$ ($1 \le N \le 10^5$). The $i$-th of the next $N$ lines contains an integer $a_i$ ($1 \le a_i \le 10^{15}$).

출력

Print the answer.

예제 입력 1

6
1
1
1
1
1
1

예제 출력 1

6