Candies
Easy
Execution time limit is 0.5 seconds
Runtime memory usage limit is 64 megabytes
The little boy got into fairy land and saw a road along which laid the bags of candy. On each bag is written the number of sweets. The boy can take in each hand, two sacks, lying beside her. What is the greatest number of candies he can take?
Input
In the only first line specifies the number of bags N (4 <= N <= 10000), then N numbers through the gap - the amount of sweets in each bag (all numbers are nonnegative and not exceed 1000000).
Output
Display only the required number - the answer to the problem.
Examples
Input #1
Answer #1
Submissions 4K
Acceptance rate 14%