#include <bits/stdc++.h>
using namespace std;
int main() {
  int W, H, N;
  int x[100], y[100], a[100];
  int l[2] = {0, N}, r[2] = {0, N};
  cin >> W >> H >> N;
  l[1] = W;
  r[1] = H;
  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) {
      l[0] = x[i];
    } else if (a[i] == 2) {
      l[1] = x[i];
    } else if (a[i] == 3) {
      r[0] = y[i];
    } else {
      r[1] = y[i];
    }
  }
  if (((l[1] - l[0]) > 0) && ((r[1] - r[0]) > 0)) {
    cout << (l[1] - l[0]) * (r[1] - r[0]) << endl;
  } else {
    cout << 0;
  }
  return 0;
}
