#include <bits/stdc++.h>
using namespace std;
const int tope = 1 << 22;
void insertar(int pos, long long int val, long long int input[3][tope]) {
  if (pos == 0) return;
  int posini = pos;
  long long int(&valor)[tope] = input[0];
  long long int(&suma)[tope] = input[1];
  long long int(&sumaprop)[tope] = input[2];
  for (; pos > 0; pos -= pos & -pos) valor[pos] += val;
  pos = posini;
  sumaprop[pos] += val * posini;
  for (; pos < tope; pos += pos & -pos) suma[pos] += val * posini;
}
void insertarentre(int posinf, int possup, long long int val,
                   long long int input[3][tope]) {
  insertar(possup, val, input);
  insertar(posinf - 1, -val, input);
}
long long int computa(int pos, long long int input[3][tope]) {
  if (pos == 0) return 0;
  int posini = pos;
  long long int val = 0;
  long long int(&valor)[tope] = input[0];
  long long int(&suma)[tope] = input[1];
  long long int(&sumaprop)[tope] = input[2];
  val -= sumaprop[pos];
  for (; pos > 0; pos -= pos & -pos) val += suma[pos];
  pos = posini;
  for (; pos < tope; pos += pos & -pos) val += valor[pos] * posini;
  return val;
}
long long int computa(int posinf, int possup, long long int input[3][tope]) {
  return computa(possup, input) - computa(posinf - 1, input);
}
int n, m, w;
long long int fila[3][tope], columna[3][tope];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> w;
  for (int i = 0; i < w; i++) {
    int tipo;
    cin >> tipo;
    if (tipo == 0) {
      int i1, j1, i2, j2;
      long long int v;
      cin >> i1 >> j1 >> i2 >> j2 >> v;
      insertarentre(i1, i2, v * (j2 - j1 + 1), fila);
      insertarentre(j1, j2, v * (i2 - i1 + 1), columna);
    } else {
      int i1, j1, i2, j2;
      cin >> i1 >> j1 >> i2 >> j2;
      cout << -(computa(1, i1 - 1, fila) + computa(i2 + 1, n, fila) +
                computa(1, j1 - 1, columna) + computa(j2 + 1, m, columna) -
                computa(i1, i2, fila) - computa(j1, j2, columna)) /
                  2
           << endl;
    }
  }
}
