Rectangle update and rectangle sum

No attempts yetTime limit1sMemory limit256 MB

Problem

You have an N×MN \times M grid. Rows are numbered 1 to NN from bottom to top, columns are numbered 1 to MM from left to right, and every cell starts at 0. Cell (i,j)(i, j) is the cell where row ii meets column jj.

Process QQ operations on the grid, in the order given.

1 a b x y w: add ww to every cell of the rectangle whose bottom left cell is (a,b)(a, b) and whose top right cell is (x,y)(x, y).

2 a b x y: print the sum of every cell of the rectangle whose bottom left cell is (a,b)(a, b) and whose top right cell is (x,y)(x, y).

Input

The first line holds NN, MM, and QQ, separated by spaces. Each of the next QQ lines holds one operation in the format above.

1N,M10001 \le N, M \le 1000 and 1Q1000001 \le Q \le 100000. Every operation satisfies 1axN1 \le a \le x \le N and 1byM1 \le b \le y \le M, and ww in an operation of type 1 is an integer with 1w10001 \le w \le 1000.

Output

For each operation of type 2, print the sum on its own line, in input order. A sum can exceed the range of a 32-bit integer.