P16934 [HackerEarth] Ankit loves football and computations related to football. Ankit has created a Football app.This app analyses the performance of a footballer. If a footballer under-performs, then a neg
普及
题目描述

Ankit loves football and computations related to football. Ankit has created a Football app.This app analyses the performance of a footballer. If a footballer under-performs, then a negative rating is awarded. If performance is good, then positive rating is awarded to the footballer.

Ankit wants to analyse the performance of a footballer over a period of N matches. Ankit wants to find consistency of a footballer. So he wants to find out the maximum consistent sum of footballer rating of a footballer only if his overall rating is positive over that period. Help Ankit in doing so.

Input

The first line contain number of matches "N" over which the analysis is to be done. The second line contains those ratings of a footballer in those N matches.

Output

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

SAMPLE INPUT
8
-1 -2 5 -1 -2 3 2 -1

SAMPLE OUTPUT
7

Explanation

Explanation:

Max and continuous sum : 5 + (-1) + (-2) +3+2 =7

输入格式

见题面

输出格式

见题面

样例输入
1 7
样例输出
443