#include <bits/stdc++.h>
using namespace std;
const int mx = 4e6 + 10;
int n, m, w;
struct bit {
  int n;
  long long t[2][mx];
  int lowbit(int x) { return x & -x; };
  void updata(int p, long long c) {
    int x = p;
    while (p <= n) {
      t[0][p] += c;
      t[1][p] += c * x;
      p += lowbit(p);
    }
  }
  long long query(int p) {
    int x = p;
    long long sum = 0;
    while (p) {
      sum += (x + 1) * t[0][p] - t[1][p];
      p -= lowbit(p);
    }
    return sum;
  }
  long long solve(int l, int r) { return query(r) - query(l - 1); }
} x, y;
int main() {
  cin >> n >> m >> w;
  x.n = n;
  y.n = m;
  int op, x1, x2, y1, y2;
  long long val;
  for (int i = 1; i <= w; ++i) {
    scanf("%d%d%d%d%d", &op, &x1, &y1, &x2, &y2);
    if (op == 0) {
      scanf("%I64d", &val);
      x.updata(x1, 1ll * (y2 - y1 + 1) * val);
      x.updata(x2 + 1, -1ll * (y2 - y1 + 1) * val);
      y.updata(y1, 1ll * (x2 - x1 + 1) * val);
      y.updata(y2 + 1, -1ll * (x2 - x1 + 1) * val);
    } else {
      printf("%I64d\n",
             y.solve(y1, y2) - x.solve(1, x1 - 1) - x.solve(x2 + 1, n));
    }
  }
}
