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