You have found a very interesting ant hill. You are so intrigued by it that you decided to find out how many ants were inside at the initial moment (when you discovered it).
To do this, you observed throughout the day and recorded an array ai — how many ants entered or exited at the i-th moment in time:
Using your observations, determine the minimum number of ants that could have been inside the ant hill before the observations began.
Note that at no point in time could there be a negative number of ants inside the ant hill.
The first line contains an integer n (1 ≤ n ≤ 105) — the number of observations made.
The second line contains n integers a1, a2, ..., an ( - 106 ≤ ai ≤ 106, i = 1, 2, ..., n) — the result of the i-th observation.
In a single line, output an integer — the minimum possible number of ants inside the ant hill before the observations began.
3
20 -50 30
30
First test example
The number of ants inside the ant hill changed as follows during the observations:
| Name |
|---|


