#include <bits/stdc++.h>
int main(void) {
  int res;
  int w, h, n;
  int x[100];
  int y[100];
  int a[100];
  int i;
  int wl;
  int wr;
  int hb;
  int ht;
  res = scanf("%d%d%d", &w, &h, &n);
  for (i = 0; i < n; i++) {
    res = scanf("%d%d%d", &x[i], &y[i], &a[i]);
  }
  wl = 0;
  hb = 0;
  wr = w;
  ht = h;
  for (i = 0; i < n; i++) {
    switch (a[i]) {
      case 1:
        if (wl < x[i]) wl = x[i];
        break;
      case 2:
        if (wr > x[i]) wr = x[i];
        break;
      case 3:
        if (hb < y[i]) hb = y[i];
        break;
      case 4:
        if (ht > y[i]) ht = y[i];
        break;
      default:
        break;
    }
  }
  if (wl > wr) wl = wr;
  if (hb > ht) hb = ht;
  printf("%d\n", (wr - wl) * (ht - hb));
  return 0;
}
