You are given an array of size
, with all elements initially equal to
. Support the following operations:
- Type 1: Given
and
, increment all
with
by
.
- Type 2: Given
and
, return the sum of all
for
.
Constraints
For all subtasks:
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line contains integers
and
, the size of the array and the number of operations to be performed.
The next lines each contain
integers
, the type number of the
operation and the parameters
and
for that operation.
Output Specification
For each operation of type output an integer on its own line, the return value of the operation.
Sample Input
8 8
2 1 8
1 1 4
2 1 2
2 2 8
1 2 3
1 2 7
1 2 8
2 1 8
Sample Output
0
1
0
4
Explanation
Right before the last operation, . The sum of all
for
is
.
Comments