#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int W, H, N;
  cin >> W >> H >> N;
  int xMax = W;
  int yMax = H;
  int xMin = 0;
  int yMin = 0;
  int a[N][3];
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
  }
  for (int i = 0; i < N; i++) {
    if (a[i][2] == 1) {
      xMin = a[i][0];
    } else if (a[i][2] == 2) {
      xMax = a[i][0];
    } else if (a[i][2] == 3) {
      yMin = a[i][1];
    } else if (a[i][2] == 4) {
      yMax = a[i][1];
    }
  }
  int width = xMax - xMin;
  int height = yMax - yMin;
  int ans = width * height;
  if (width <= 0 || height <= 0) {
    cout << 0 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}
