'''
连续子序列最大和
'''

# num = raw_input("")
# line = raw_input("")
# line = map(lambda x:int(x),line.split(" "))
# num = int(num)
#
# d =[0]*(num-1)
# d.insert(0,line[0])
#
# for i in range(1,num):
#
#     d[i] = max(d[i-1]+line[i],line[i])
#
# print max(d)