#include <bits/stdc++.h>
int main(void) {
  int W, H, N, x[100], y[100], a[100], i, j, pox[102], poy[102], ansx = 0,
                                                                 ansy = 0;
  scanf("%d %d %d", &W, &H, &N);
  for (i = 0; i < N; i++) {
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
  }
  for (i = 0; i < 101; i++) {
    pox[i] = 1;
    poy[i] = 1;
  }
  for (i = 0; i < N; i++) {
    if (a[i] == 1) {
      for (j = 0; j < x[i]; j++) pox[j] = 0;
    } else if (a[i] == 2) {
      for (j = W - 1; j > x[i] - 1; j--) pox[j] = 0;
    } else if (a[i] == 3) {
      for (j = 0; j < y[i]; j++) poy[j] = 0;
    } else {
      for (j = H - 1; j > y[i] - 1; j--) poy[j] = 0;
    }
  }
  for (i = 0; i < W; i++) {
    if (pox[i] == 1) ansx++;
  }
  for (i = 0; i < H; i++) {
    if (poy[i] == 1) ansy++;
  }
  printf("%d\n", ansx * ansy);
  return 0;
}
