#include <bits/stdc++.h>
using namespace std;
int main() {
  int W, H, N, a;
  cin >> W >> H >> N;
  int x, y, hi = 0, mi = W, ue = 0, si = H;
  for (int i = 0; i < N; i++) {
    cin >> x >> y >> a;
    if (a == 1 && x > hi) {
      hi = x;
    }
    if (a == 2 && x < mi) {
      mi = x;
    }
    if (a == 3 && y > ue) {
      ue = y;
    }
    if (a == 4 && y < si) {
      si = y;
    }
  }
  if ((mi - hi) * (si - ue) <= 0) {
    cout << 0 << endl;
  } else {
    cout << (mi - hi) * (si - ue) << endl;
  }
  return 0;
}
