To prepare for his village's annual festival, Rexzae plans on putting on a display of fireworks. According to the village's spiritual beliefs, each firework is associated with a particular number, which they call its "colour". Currently, he has already set up
Constraints
In all subtasks,
The range of the colours of the different fireworks will not exceed
Subtask 1 [20%]
Subtask 2 [30%]
There are no queries of the first or second type.
Subtask 3 [50%]
No additional constraints.
Input Specification
The first line contains two space-separated integers,
The second line contains
1 d
- Rexzae adds a new firework with colour
2 a
- Rexzae adds
3 k
- Rexzae wants to know the minimum cost for setting up a fireworks display that has a festivity of
Note: Rexzae does not actually change the colours of his fireworks during a k
operation.
Output Specification
For each query of the third type, output the minimum cost for setting up a fireworks display that has a festivity of
Sample Input
5 9
1 3 5 7 9
3 1
3 2
2 -3
3 3
1 14
2 5
3 5
3 7
3 10
Sample Output
0
5
3
7
12
14
Comments