#K33077. Grid Update Operations Sum

    ID: 25007 Type: Default 1000ms 256MiB

Grid Update Operations Sum

Grid Update Operations Sum

You are given a grid with N rows and M columns, initially filled with 0s. You need to process Q update operations. Each operation is represented by four integers r_1, c_1, r_2, c_2 and corresponds to incrementing each element of the subgrid from row r_1 to r_2 and column c_1 to c_2 by 1. Mathematically, for each operation, for all indices satisfying \[ r_1 \leq i \leq r_2, \quad c_1 \leq j \leq c_2, \] you perform grid[i][j] += 1.

After processing all the operations, compute and output the sum of all elements in the grid.

Note: All indices are 1-indexed.

inputFormat

The input is read from stdin and has the following format:

N M Q
r1 c1 r2 c2
r1 c1 r2 c2
... (Q lines in total)

Where N is the number of rows, M is the number of columns, and Q is the number of operations. Each of the next Q lines contains four integers representing the coordinates of an update operation.

outputFormat

Output a single integer to stdout representing the sum of all elements in the grid after all operations have been performed.

## sample
3 3 2
1 1 2 2
2 2 3 3
8