Inna loves sweets very much. That's why she wants to play the "Sweet Matrix" game with Dima and Sereja. But Sereja is a large person, so the game proved small for him. Sereja suggested playing the "Large Sweet Matrix" game.

The "Large Sweet Matrix" playing field is an n × m matrix. Let's number the rows of the matrix from 1 to n, and the columns — from 1 to m. Let's denote the cell in the i-th row and j-th column as (i, j). Each cell of the matrix can contain multiple candies, initially all cells are empty. The game goes in w moves, during each move one of the two following events occurs:

  1. Sereja chooses five integers x1, y1, x2, y2, v (x1 ≤ x2, y1 ≤ y2) and adds v candies to each matrix cell (i, j) (x1 ≤ i ≤ x2; y1 ≤ j ≤ y2). 
  2. Sereja chooses four integers x1, y1, x2, y2 (x1 ≤ x2, y1 ≤ y2). Then he asks Dima to calculate the total number of candies in cells (i, j) (x1 ≤ i ≤ x2; y1 ≤ j ≤ y2) and he asks Inna to calculate the total number of candies in the cells of matrix (p, q), which meet the following logical criteria: (p < x1 OR p > x2) AND (q < y1 OR q > y2). Finally, Sereja asks to write down the difference between the number Dima has calculated and the number Inna has calculated (D - I). 



Unfortunately, Sereja's matrix is really huge. That's why Inna and Dima aren't coping with the calculating. Help them!

Input

The first line of the input contains three integers n, m and w (3 ≤ n, m ≤ 4·106; 1 ≤ w ≤ 105).

The next w lines describe the moves that were made in the game. 

  * A line that describes an event of the first type contains 6 integers: 0, x1, y1, x2, y2 and v (1 ≤ x1 ≤ x2 ≤ n; 1 ≤ y1 ≤ y2 ≤ m; 1 ≤ v ≤ 109). 
  * A line that describes an event of the second type contains 5 integers: 1, x1, y1, x2, y2 (2 ≤ x1 ≤ x2 ≤ n - 1; 2 ≤ y1 ≤ y2 ≤ m - 1). 



It is guaranteed that the second type move occurs at least once. It is guaranteed that a single operation will not add more than 109 candies.

Be careful, the constraints are very large, so please use optimal data structures. Max-tests will be in pretests.

Output

For each second type move print a single integer on a single line — the difference between Dima and Inna's numbers.

Examples

Input

4 5 5
0 1 1 2 3 2
0 2 2 3 3 3
0 1 5 4 5 1
1 2 3 3 4
1 3 4 3 4


Output

2
-21

Note

Note to the sample. After the first query the matrix looks as: 
    
    
      
    22200  
    22200   
    00000  
    00000  
    

After the second one it is: 
    
    
      
    22200  
    25500  
    03300   
    00000  
    

After the third one it is: 
    
    
      
    22201  
    25501  
    03301  
    00001  
    

For the fourth query, Dima's sum equals 5 + 0 + 3 + 0 = 8 and Inna's sum equals 4 + 1 + 0 + 1 = 6. The answer to the query equals 8 - 6 = 2. For the fifth query, Dima's sum equals 0 and Inna's sum equals 18 + 2 + 0 + 1 = 21. The answer to the query is 0 - 21 = -21.
import java.io.*;
import java.util.*;
public class e {
public static void main(String[] args) throws IOException {
	input.init(System.in);
	PrintWriter out = new PrintWriter(System.out);
	int n = input.nextInt(), m = input.nextInt(), w = input.nextInt();
	BIT xit = new BIT(n);
	BIT yit = new BIT(m);
	for(int ww = 0; ww<w; ww++)
	{
		int type = input.nextInt();
		if(type == 0)
		{
			int x1 = input.nextInt()-1, y1 = input.nextInt()-1, x2 = input.nextInt()-1, y2 = input.nextInt()-1;
			long v = input.nextInt();
			xit.add(x1, x2, v * (y2 - y1 + 1));
			yit.add(y1, y2, v * (x2 - x1 + 1));
		}
		else
		{
			int x1 = input.nextInt()-1, y1 = input.nextInt()-1, x2 = input.nextInt()-1, y2 = input.nextInt()-1;
			long xres = xit.get(x1, x2) - xit.get(0, x1-1) - xit.get(x2+1, n-1);
			long yres = yit.get(y1, y2) - yit.get(0, y1-1) - yit.get(y2+1, m-1);
			out.println((xres+yres)/2);
		}
	}
	out.close();
}
static class BIT {
long[] add;
long[] mult;
int n;
/*
 * Adds x to elements a through b, inclusive.
 */
BIT(int nn)
{
	n =  nn;
	add = new long[n+1];
	mult = new long[n+1];
}
void add(int a, int b, long v)
{
	a++;
	b++;
	upd(a,v,-v*(a-1));
    upd(b,-v,v*b);
}
void upd(int x, long v1, long v2)
{
	int i = x;
	while(i<=n)
	{
		mult[i]+=v1;
		add[i]+=v2;
		i += (i&-i);
	}
}
/*
 * Returns the sum of the elements 1 through x, inclusive.
 */
long get(int x, int y)
{
	return query(y) - query(x-1);
}
long query(int x)
{
	x++;
	if(x == 0) return 0;
	long sa = 0, sm = 0, z = x;
	while(x>0)
	{
		sa += add[x];
		sm += mult[x];
		x -= (x&-x);
	}
	return sm*z+sa;
}
}
//Minimum Interval Tree
static class IT
{
int[] a, b;
long[] val, prop;
IT(int n)
{
	val = new long[4*n];
	prop = new long[4*n];
	a = new int[4*n];
	b = new int[4*n];
	init(0,0, n-1);
}
int init(int at, int l, int r)
{
	a[at] = l;
	b[at] = r;
	if(l==r); //2*at+1 = right [at] = -1;
	else 
	{
		int mid = (l+r)/2;
		init(2*at+1,l,mid);
		init(2*at+2,mid+1,r);
	}
	return at++;
}
//return the min over [x,y]
long get(int x, int y)
{
	return go(x,y, 0);
}
void push(int at)
{
	if(prop[at] != 0)
	{
		go3(a[2*at+1], b[2*at+1], prop[at], 2*at+1);
		go3(a[2*at+2], b[2*at+2], prop[at], 2*at+2);
		prop[at] = 0;
	}
}
long go(int x,int y, int at)
{
	if(at==-1 || y<a[at] || x>b[at]) return 0;
	if(x <= a[at] && y>= b[at]) return val[at];
	push(at);
	return (go(x, y, 2*at+1) + go(x, y, 2*at+2));
}
//add v to elements x through y
void add(int x, int y, long v)
{
	go3(x, y, v, 0);
}
void go3(int x, int y, long v, int at)
{
	if(at==-1) return;
	if(y < a[at] || x > b[at]) return;
	x = Math.max(x, a[at]);
	y = Math.min(y, b[at]);
	if(y == b[at] && x == a[at])
	{
		val[at] += (long)v * (b[at] - a[at] + 1);
		prop[at] += v;
		return;
	}
	push(at);
	go3(x, y, v, 2*at+1);
	go3(x, y, v, 2*at+2);
	val[at] = (val[2*at+1] + val[2*at+2]);
}
}
public static class input {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(reader.readLine());
		return tokenizer.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}
}

