Student's Score

2.7

29 votes
Problem

PIET's CS department has been continuously organizing mock placement drives for students. If a student under-performs negative point is rewarded otherwise positive points is rewarded. The HOD wants to find consistency of a student. So, he wants to find out maximum consistent sum of a student score only if his/her overall rating is positive. Help HOD in doing so.

Input

The first line contain number of drives N over which the analysis is to be done. The second line contains score of student in those N drives.

Output

Print a single integer i.e. the maximum consistent score of the student if it is positive otherwise output 0 (zero).

Sample Input
8
-1 -4  4 -2 0 1 4 -5
Sample Output
7
Time Limit: 3
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?