#include <bits/stdc++.h>
int main() {
  int w, h, n, i;
  int x1, x2, x3, x4;
  int y1, y2, y3, y4;
  scanf("%d %d %d", &w, &h, &n);
  int a, b, c;
  x1 = 0;
  y1 = 0;
  x2 = w;
  y2 = 0;
  x3 = 0;
  y3 = h;
  x4 = w;
  y4 = h;
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &a, &b, &c);
    switch (c) {
      case 1:
        if (x1 < a) {
          x1 = a;
          x3 = a;
        }
        break;
      case 2:
        if (x2 > a) {
          x2 = a;
          x4 = a;
        }
        break;
      case 3:
        if (y1 < b) {
          y1 = b;
          y2 = b;
        }
        break;
      case 4:
        if (y3 > b) {
          y3 = b;
          y4 = b;
        }
        break;
    }
  }
  int xa, ya;
  xa = x2 - x1;
  ya = y3 - y1;
  if (xa < 0 || ya < 0) {
    printf("0\n");
  } else {
    printf("%d\n", xa * ya);
  }
  return 0;
}
