Jack is scrambling to finish his data homework! He needs to survey his classmates on how much they like chocomint for his summative assignment, and then put that data through his specialized model he dubs, Matroicutree. Matroicutree works by modelling Jack's classmates as an array
, where each classmate
has an opinion of
. Jack updates the model by looking at certain ranges
of his classmates to see how many of them have exactly an opinion of
(this
is generated automatically by Matroicutree).
However, Jack's classmates are very fickle and often like to change their minds. In each opinion change, classmate can have their opinion (
) increase by
or decrease by
. Jack needs to incorporate these new changes into his final model. Help Jack finish his data homework on time!
Input Specification
Each classmate initially has an opinion of .
The first line consists of two integers, and
.
denotes the number of classmates and
the number of queries Jack needs to ask you in order to get his algorithm to successfully work.
Each query is one of the following:
1 x
Increment classmate's opinion of chocomint by
.
2 x
Decrement classmate's opinion of chocomint by
.
3 l r c
Output how many classmates from the-th index to the
-th index have exactly an opinion
of chocomint.
Output Specification
For each type query that Jack asks you, output the answer on its own line.
Constraints
For all subtasks:
Subtask 1 [10%]
Subtask 2 [90%]
No additional constraints.
Sample Input
10 10
1 5
3 4 5 0
1 10
3 9 10 -1
2 8
3 8 10 -1
3 1 10 0
3 6 10 -2
1 5
3 4 9 2
Sample Output
1
0
1
7
0
1
Explanation of Sample Output
Initially, all opinions of chocomint are . After query 1, classmate
's opinion of chocomint increases by
. For query 2, classmate
still has an opinion of
, but classmate
now has an opinion of
, so there is exactly
person in the range
who has an opinion of
.
Comments