Your friend is a lazy person.
He has N classes on each Monday, where all of these classes happen in the same room.
Like everybody else, he likes some classes but also dislikes other classes.
Specifically, the i'th class gives A[i] happiness to him, where A[i] may be positive, negative, or zero.
It would be nice for him to attend classes so that the sum of happiness he get is maximum, but it is not an option for him to leave the class and then come back for another, because he is too lazy to move. In other words, he may only choose to attend classes that are conducted successively (one after another).
Again, lazy as your friend is, he wants you to find the maximum happiness he can achieve by optimally choosing the classes.
N
A_1
A_2
...
A_N
(N is a positive integer not exceeding 5000, A_i is an integer where|A_i| <= 10000)
It is guaranteed that at least one of A_i is positive.
The maximum happiness, followed by a newline character.