#D7346. RSQ and RUQ
RSQ and RUQ
RSQ and RUQ
Write a program which manipulates a sequence = {} with the following operations:
- : change to .
- : print the sum of .
Note that the initial values of are 0.
Constraints
Input
:
In the first line, (the number of elements in ) and (the number of queries) are given. Then, -th query is given in the following format:
0
or
1
The first digit represents the type of the query. '0' denotes and '1' denotes .
Output
For each query, print the sum in a line.
Example
Input
6 7 0 1 3 1 0 2 4 -2 1 0 5 1 0 1 0 3 5 3 1 3 4 1 0 5
Output
-5 1 6 8
inputFormat
Input
:
In the first line, (the number of elements in ) and (the number of queries) are given. Then, -th query is given in the following format:
0
or
1
The first digit represents the type of the query. '0' denotes and '1' denotes .
outputFormat
Output
For each query, print the sum in a line.
Example
Input
6 7 0 1 3 1 0 2 4 -2 1 0 5 1 0 1 0 3 5 3 1 3 4 1 0 5
Output
-5 1 6 8
样例
6 7
0 1 3 1
0 2 4 -2
1 0 5
1 0 1
0 3 5 3
1 3 4
1 0 5
-5
1
6
8
</p>