loves to build snowmen. But his favorite type has to be arithmetic snowmen. An arithmetic snowman consists of 3 snowballs whose sizes, when arranged in a non-decreasing order, form an arithmetic sequence. For example, can make an arithmetic snowman out of snowballs of sizes 1, 3, and 5.
The size of an arithmetic snowman is the sum of the sizes of the snowballs that it's made of.
Constraints
Subtask 1 [50%]
Subtask 2 [50%]
Input Specification
The first line of input will contain
The second line of input will contain
Output Specification
One integer, the size of the largest arithmetic snowman
can build. It is guaranteed that he can build at least one.Sample Input
Copy
7
4 2 8 10 14 3 7
Sample Output
Copy
24
Explanation for Sample Output
will use the snowballs of sizes 2, 8, and 14 to make the snowman.
Comments
It says:
But i think the sizes are repeated in batch #1
Varying sizes does not imply that all sizes are distinct, sorry for the confusion.