#include <bits/stdc++.h>
int main() {
  int N, W, H;
  scanf("%d %d %d", &W, &H, &N);
  int x[101], y[101], a[101];
  int Rx = W, Lx = 0, Oy = H, Uy = 0;
  int i;
  for (i = 1; i <= N; i++) {
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
    switch (a[i]) {
      case 1:
        if (Lx <= x[i]) Lx = x[i];
        break;
      case 2:
        if (Rx >= x[i]) Rx = x[i];
        break;
      case 3:
        if (Uy <= y[i]) Uy = y[i];
        break;
      case 4:
        if (Oy >= y[i]) Oy = y[i];
        break;
    }
  }
  if (Lx >= Rx || Oy <= Uy) {
    printf("0");
    return 0;
  }
  printf("%d", (Rx - Lx) * (Oy - Uy));
}
