#c22708. 二维差分2

二维差分2

2D Difference Array (II)

Problem Description

You are given an n×mn \times m matrix a1,1,a1,2,…,a1,m,…,an,ma_{1,1}, a_{1,2}, \dots, a_{1,m}, \dots, a_{n,m} and qq update operations.

Initially all positions are 00. Each update gives five numbers x1,y1,x2,y2,dx_1, y_1, x_2, y_2, d and adds dd to every ai,ja_{i,j} with x1≤i≤x2x_1 \leq i \leq x_2 and y1≤j≤y2y_1 \leq j \leq y_2.

Compute the value of the whole matrix after all operations.

Input Format

The first line contains three integers n,m,qn, m, q (1≤n,m≤1091 \leq n, m \leq 10^9, q≤2×103q \leq 2\times 10^3).

The next qq lines each contain five integers x1,y1,x2,y2,dx_1, y_1, x_2, y_2, d (1≤x1≤x2≤n1 \leq x_1 \leq x_2 \leq n, 1≤y1≤y2≤m1 \leq y_1 \leq y_2 \leq m, 1≤d≤1091 \leq d \leq 10^9).

Output Format

To avoid overly large output, output the XOR sum of all numbers in the matrix after all operations.

Sample Input

5 5 3
1 1 2 3 5
2 2 4 3 6
4 3 5 5 10

Sample Output

28