Write a program that reads a sequence of numbers, and prints the maximum quantity that can be obtained by adding numbers consecutively from the beginning, and the maximum quantity that can be obtained by adding numbers consecutively from the end.
Input consists of several cases. Each case begins with a number , followed by integer numbers.
For every case, print two numbers: the maximum quantity that can be obtained by adding zero or more consecutive numbers from the beginning, and the maximum quantity that can be obtained by adding zero or more consecutive numbers from the end.
Input
4 0 1 2 3 6 1 1 -9 2 0 1 5 -5 -3 6 -1 -1
Output
6 6 2 3 0 4