Thylacine#5331

Thylacine

1 second
122.174 megabytes
Very easy

Given a sequence of integers, find a non-empty contiguous subsequence with the maximum possible sum.

Input

The first line contains the integer (1 \leq n \leq 10^6). The second line contains integers a_1, a_2, \ldots, a_n (|a_i| \leq 1000 for all ).

Output

Print the maximum sum of numbers in any non-empty contiguous subsequence.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading