#include using namespace std; typedef long long ll; typedef std::pair P; int main() { ll h, w, n; cin >> h >> w >> n; queue

que; for (int i = 1; i <= h; ++i) { for (int j = 1; j <= w; ++j) que.push({i, j}); } for (int i = 0; i < n; ++i) { queue

nq; ll r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2; while (!que.empty()) { ll f = que.front().first; ll s = que.front().second; que.pop(); if (r1 > f || f > r2 || c1 > s || s > c2) nq.push({f, s}); } swap(que, nq); } cout << que.size() << endl; }