#include <bits/stdc++.h>
using namespace std;
int main() {
  double w, h, n, a, b, c;
  cin >> w >> h >> n;
  double xl, xr, yu, yd;
  xl = 0;
  xr = w;
  yu = h;
  yd = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c;
    if (c == 1) {
      xl = a;
    } else if (c == 2) {
      xr = a;
    } else if (c == 3) {
      yd = b;
    } else if (c == 4) {
      yu = b;
    }
    if ((xr - xl) <= 0 or (yu - yd) <= 0) {
      cout << 0;
      break;
    }
  }
  if ((xr - xl) > 0 and (yu - yd) > 0) {
    cout << (xr - xl) * (yu - yd);
  }
}
