#include <bits/stdc++.h>
int main() {
  int i;
  int w, h, n;
  scanf("%d %d %d", &w, &h, &n);
  int xl = 0, yl = 0, xh = w, yh = h;
  for (i = 0; i < n; i++) {
    int a;
    scanf("%d %d %d", &w, &h, &a);
    switch (a) {
      case 1:
        if (xl < w) {
          xl = w;
        }
        break;
      case 2:
        if (xh > w) {
          xh = w;
        }
        break;
      case 3:
        if (yl < h) {
          yl = h;
        }
        break;
      case 4:
        if (yh > h) {
          yh = h;
        }
        break;
      default:
        return 1;
    }
  }
  if (xl > xh || yl > yh) {
    printf("%d", 0);
  } else {
    printf("%d", (xh - xl) * (yh - yl));
  }
  return 0;
}
