#abc182d. [abc182_d]Wandering

[abc182_d]Wandering

Problem Statement

Given is a number sequence A1,A2,A3,dots,ANA_1, A_2, A_3, \\dots, A_N, which may contain negative elements.
On a number line, there is a robot at coordinate 00. It will do the following actions in order:

  • Move A1A_1 in the positive direction.
  • Move A1A_1 in the positive direction, and then move A2A_2 in the positive direction.
  • Move A1A_1 in the positive direction, then move A2A_2 in the positive direction, and then move A3A_3 in the positive direction.

hspace140ptvdots\\hspace{140pt} \\vdots

  • Move A1A_1 in the positive direction, then move A2A_2 in the positive direction, then move A3A_3 in the positive direction, ldots\\ldots, dots\\dots, and then move ANA_N in the positive direction.

Find the greatest coordinate occupied by the robot from the beginning to the end of the process.

Constraints

  • 1leNle2000001 \\le N \\le 200000
  • \-108leAile108\-10^8 \\le A_i \\le 10^8
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN $A_1 \\hspace{7pt} A_2 \\hspace{7pt} A_3 \\hspace{5pt} \\dots \\hspace{5pt} A_N$

Output

Print the greatest coordinate occupied by the robot from the beginning to the end of the process.


Sample Input 1

3
2 -1 -2

Sample Output 1

5

The robot moves as follows:

  • Move 22 in the positive direction, to coordinate 22.
  • Move 22 in the positive direction, to coordinate 44. Then move \-1\-1 in the positive direction, to coordinate 33.
  • Move 22 in the positive direction, to coordinate 55. Then move \-1\-1 in the positive direction, to coordinate 44. Then move \-2\-2 in the positive direction, to coordinate 22.

The greatest coordinate occupied during the process is 55, so we should print 55.


Sample Input 2

5
-2 1 3 -1 -1

Sample Output 2

2

Sample Input 3

5
-1000 -1000 -1000 -1000 -1000

Sample Output 3

0

In this case, the initial coordinate 00 is the greatest coordinate occupied.