#include <bits/stdc++.h>
int main() {
  long W = 0, H = 0, N = 0;
  long x = 0, y = 0, a = 0;
  long size = 0;
  scanf("%d%d%d", &W, &H, &N);
  int l = 0, r = W, u = H, d = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d%d%d", &x, &y, &a);
    switch (a) {
      case 1:
        if (l < x) l = x;
        break;
      case 2:
        if (r > x) r = x;
        break;
      case 4:
        if (u > y) u = y;
        break;
      case 3:
        if (d < x) d = y;
        break;
    }
  }
  size = (r - l) * (u - d);
  if (r < l || u < d) size = 0;
  printf("%ld", size);
  return 0;
}
