Time limit
1s
Memory limit
128 MB
You are given a sequence of n integers. Find the maximum possible sum obtainable by choosing one or more consecutive elements of the sequence.
The first line contains an integer n (1 ≤ n ≤ 100,000).
The second line contains n integers separated by spaces. Each integer is between -1,000 and 1,000, inclusive.
Print the maximum sum obtainable by choosing one or more consecutive elements.