#include <bits/stdc++.h>
using namespace std;
int main() {
  long long width, height, N;
  long long uplimit;
  long long lowlimit = 0;
  long long rightlimit;
  long long leftlimit = 0;
  long long S;
  long long x[101], y[101], a[101];
  cin >> width >> height >> N;
  uplimit = height;
  rightlimit = width;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> a[i];
  }
  for (int i = 0; i < N; i++) {
    if (a[i] == 1 && leftlimit < x[i]) {
      leftlimit = x[i];
    } else if (a[i] == 2 && rightlimit > x[i]) {
      rightlimit = x[i];
    } else if (a[i] == 3 && lowlimit < y[i]) {
      lowlimit = y[i];
    } else if (a[i] == 4 && uplimit > y[i]) {
      uplimit = y[i];
    }
  }
  if ((uplimit - lowlimit) * (rightlimit - leftlimit) <= 0) {
    S = 0;
  } else {
    S = (uplimit - lowlimit) * (rightlimit - leftlimit);
  }
  cout << S << endl;
  return 0;
}
