#include <bits/stdc++.h>
int main(void) {
  int W, H, N;
  int x[100];
  int y[100];
  int a[100];
  int i;
  int sum;
  scanf("%d", &W);
  scanf("%d", &H);
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &x[i]);
    scanf("%d", &y[i]);
    scanf("%d", &a[i]);
  }
  sum = W * H;
  for (i = 0; i < N; i++) {
    switch (a[i]) {
      case 1:
        sum -= x[i] * H;
        W = W - x[i];
        break;
      case 2:
        sum -= (W - x[i]) * H;
        W = x[i];
        break;
      case 3:
        sum -= y[i] * W;
        H = H - y[i];
        break;
      case 4:
        sum -= (H - y[i]) * W;
        H = y[i];
        break;
    }
  }
  printf("%d\n", sum);
  return 0;
}
