#D11051. RMQ and RAQ
RMQ and RAQ
RMQ and RAQ
Write a program which manipulates a sequence = {} with the following operations:
- : add to .
- : report the minimum value in .
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 minimum value.
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
-2 0 1 -1
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 minimum value.
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
-2 0 1 -1
样例
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
-2
0
1
-1
</p>