In this problem, you have to efficiently keep a vector with integers. There is just one update operation: given any position between 0 and , and an integer , set . Appart from that, you have to repeatedly report the maximum sum of all the consecutive subsequences of the current vector.
Input consists of several cases. Every case begins with , followed by the initial content of , followed by operations, each one with a pair . You can assume , , and .
For every case, print numbers: the maximum sum of consecutive elements inside the vector before the first update, and also after every update. Print a line with 10 dashes at the end of each case.
Input
3 10 5 10 0 -3 1 -8 0 20 1 -300 0 0 3 1000000000000 1000000000000 1000000000000 1 -1 2 -1000000000000 2 2
Output
25 15 10 22 ---------- 0 0 ---------- 3000000000000 1999999999999 1000000000000 1000000000001 ----------