#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> segment[2];
int n, m, w, t1, t2;
long long tot;
long long update(int a, int b, int tag, long long val, int curr, int l, int r) {
  if (b < l || a > r) {
    return 0;
  }
  if (a <= l && b >= r) {
    segment[tag][curr].first += (r - l + 1) * val;
    segment[tag][curr].second += val;
    return segment[tag][curr].first;
  }
  int m = (l + r) / 2;
  segment[tag][2 * curr].first += (r - m) * segment[tag][curr].second,
      segment[tag][2 * curr + 1].first += (r - m) * segment[tag][curr].second;
  segment[tag][2 * curr].second += segment[tag][curr].second,
      segment[tag][2 * curr + 1].second += segment[tag][curr].second;
  segment[tag][curr].second = 0;
  long long ret = update(a, b, tag, val, 2 * curr, l, m) +
                  update(a, b, tag, val, 2 * curr + 1, m + 1, r);
  segment[tag][curr].first =
      segment[tag][2 * curr].first + segment[tag][2 * curr + 1].first;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  cin >> n >> m >> w;
  t1 = pow(2, ceil(log2(n))), t2 = pow(2, ceil(log2(m)));
  segment[0].resize(2 * t1, {0, 0});
  segment[1].resize(2 * t2, {0, 0});
  while (w--) {
    int a, x1, y1, x2, y2;
    cin >> a >> x1 >> y1 >> x2 >> y2;
    if (a == 0) {
      long long v;
      cin >> v;
      tot += (y2 - y1 + 1) * (x2 - x1 + 1) * v;
      update(x1, x2, 0, v * (y2 - y1 + 1), 1, 1, t1);
      update(y1, y2, 1, v * (x2 - x1 + 1), 1, 1, t2);
    } else {
      cout << -tot + update(x1, x2, 0, 0, 1, 1, t1) +
                  update(y1, y2, 1, 0, 1, 1, t2)
           << '\n';
    }
  }
}
