LearnPy Hub
← Arena
IntermediateRating 1100

Best Stretch

Print the maximum sum of a non-empty contiguous subarray. n ≤ 2·10⁵.

Input

n, then n integers.

Output

The maximum sum.

Sample 1

Input
9
-2 1 -3 4 -1 2 1 -5 4
Output
6

Sample 2

Input
1
-7
Output
-7
solution.py
Output appears here
Best Stretch · Python Arena problem · LearnPy Hub