#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, hL;
  int wH, hH;
  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;
  hL = 0;
  wH = w;
  hH = h;
  for (i = 0; i < n; i++) {
    switch (a[i]) {
      case 1:
        if (wL < x[i]) {
          wL = x[i];
        }
        break;
      case 2:
        if (wH > x[i]) {
          wH = x[i];
        }
        break;
      case 3:
        if (hL < y[i]) {
          hL = y[i];
        }
        break;
      case 4:
        if (hH > y[i]) {
          hH = y[i];
        }
        break;
      default:
        break;
    }
  }
  if (wL > wH) wL = wH;
  if (hL > hH) hL = hH;
  printf("%d\n", (wH - wL) * (hH - hL));
  return 0;
}
