~/algor $ cat problems/minmax/sum-of-the-three-largest-numbers
Sum of the three largest numbers
Medium
1000 ms
128 MB
53%
A positive integer and integers are given. Choose three elements at different positions of the sequence so that their sum is the largest. Find this sum.
Input
The first line contains a positive integer . The next line contains integers .
Output
One integer.
Note
Examples
Input #1
6 4 9 1 7 9 3
Output #1
25
Input #2
3 -2 -5 -1
Output #2
-8