#abc253f. [abc253_f]Operations on a Matrix

[abc253_f]Operations on a Matrix

Problem Statement

We have an NtimesMN \\times M matrix, whose elements are initially all 00.

Process QQ given queries. Each query is in one of the following formats.

  • 1 l r x : Add xx to every element in the ll-th, (l+1)(l+1)-th, ldots\\ldots, and rr-th column.
  • 2 i x: Replace every element in the ii-th row with xx.
  • 3 i j: Print the (i,j)(i, j)-th element.

Constraints

  • 1leqN,M,Qleq2times1051 \\leq N, M, Q \\leq 2 \\times 10^5
  • Every query is in one of the formats listed in the Problem Statement.
  • For each query in the format 1 l r x, 1leqlleqrleqM1 \\leq l \\leq r \\leq M and 1leqxleq1091 \\leq x \\leq 10^9.
  • For each query in the format 2 i x, 1leqileqN1 \\leq i \\leq N and 1leqxleq1091 \\leq x \\leq 10^9.
  • For each query in the format 3 i j, 1leqileqN1 \\leq i \\leq N and 1leqjleqM1 \\leq j \\leq M.
  • At least one query in the format 3 i j is given.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM QQ mathrmQuery1\\mathrm{Query}_1 vdots\\vdots mathrmQueryQ\\mathrm{Query}_Q

mathrmQueryi\\mathrm{Query}_i, which denotes the ii-th query, is in one of the following formats:

11 ll rr xx 22 ii xx 33 ii jj

Output

For each query in the format 3 i j, print a single line containing the answer.


Sample Input 1

3 3 9
1 1 2 1
3 2 2
2 3 2
3 3 3
3 3 1
1 2 3 3
3 3 2
3 2 3
3 1 2

Sample Output 1

1
2
2
5
3
4

The matrix transitions as follows.

$\\begin{pmatrix} 0 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ \\end{pmatrix} \\rightarrow \\begin{pmatrix} 1 & 1 & 0 \\\\ 1 & 1 & 0 \\\\ 1 & 1 & 0 \\\\ \\end{pmatrix} \\rightarrow \\begin{pmatrix} 1 & 1 & 0 \\\\ 1 & 1 & 0 \\\\ 2 & 2 & 2 \\\\ \\end{pmatrix} \\rightarrow \\begin{pmatrix} 1 & 4 & 3 \\\\ 1 & 4 & 3 \\\\ 2 & 5 & 5 \\\\ \\end{pmatrix}$


Sample Input 2

1 1 10
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
1 1 1 1000000000
3 1 1

Sample Output 2

9000000000

Sample Input 3

10 10 10
1 1 8 5
2 2 6
3 2 1
3 4 7
1 5 9 7
3 3 2
3 2 8
2 8 10
3 8 8
3 1 10

Sample Output 3

6
5
5
13
10
0