#ds102. 树状数组2
树状数组2
Fenwick Tree 2
Problem Description
There are numbers , all initially .
You must support operations:
1 l r d: add to every with .2 x: output .
Input Format
The first line contains two integers and ().
The following lines each describe an operation of the form 1 l r d or 2 x, with , , and .
Output Format
For each query, output one line containing the answer.
Sample Input
5 5
1 2 3 1
1 1 5 2
2 4
1 1 3 3
2 5
Sample Output
10
21
Constraints
, , , .