5093 - 最大子序列和

通过次数

16

提交次数

39

Time Limit : 1 秒
Memory Limit : 128 MB

求一个数列中某个区间内数字连续加起来最大,请输出最大值

Input

第一行一个数字n,表示有几个数字 第二行n个整数,每个整数之间一个空格 1<=n<=10000000

Output

一个整数,表示最大值

Examples

Input

2
1 2

Output

3

Input

3
1 2 -3

Output

3