LearnPy Hub
← Arena
IntermediateRating 1200

Biggest Triangle

Pick three sticks that form a real triangle (each side shorter than the other two together) with the largest perimeter. Print it, or 0 if no triangle is possible.

Input

n, then n lengths.

Output

One integer.

Sample 1

Input
3
2 1 2
Output
5

Sample 2

Input
3
1 2 1
Output
0
solution.py
Output appears here
Biggest Triangle · Python Arena problem · LearnPy Hub