After your successful efforts in timing the alien invasion, Flatland has emerged victorious! of the alien ships have been salvaged and the Flatlanders want to use them to build not one, not two, but three tall statues commemorating this independence day!
Each of the alien ships has it's own length. The Flatlanders line these ships up on end to form three stacks. In order to create a balanced visual piece, they would like to minimize the length of the longest statue. Can you help them determine the minimum height of the longest statue?
Input
Each test case begins with an integer . The next line contains integers , representing the lengths of the ships.
Output
For each test case, output one integer : the minimum length of the longest statue.
Sample Input
4
1 2 3 2
Sample Output
3
Sample Input
6
3 4 5 4 9 8
Sample Output
12
Comments
New test data has been added to stop hard-code solutions from passing.
@EhhThing