1954 连年最大变化


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

学生会会长小明,手上有一张记录了校内各个社团成立以来,每年社员人数变化(与上一年比,有正有负),你能帮他计算出每个社团的连年最大人数变化(即某连续几年中人数和最大)么?若社团成立期间人数一直在减少,则记为0。

Input

多组数据。每组数据由一个整数N(0<N<=30)领衔,后跟N个整数([-50,50]),表示每年变化的人数。若N为0,则输入结束。

Output

每组输出一个整数,标明该社团连年最大人数变化。

Sample

Input

5
17 6 39 8 -32 
10
-2 48 16 32 -17 42 2 14 9 43
2
-23 -29 
0

Output

70
189
0

Source: qn


Comments

There are no comments at the moment.