#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int W, H, N;
  int x, y, a;
  int w0, w1, h0, h1;
  int i;
  scanf("%d %d %d", &W, &H, &N);
  w0 = 0;
  w1 = W;
  h0 = 0;
  h1 = H;
  for (i = 0; i < N; i++) {
    scanf("%d %d %d", &x, &y, &a);
    if ((a == 1) && (x > w0)) w0 = x;
    if ((a == 2) && (x < w1)) w1 = x;
    if ((a == 3) && (y > h0)) h0 = y;
    if ((a == 4) && (y < h1)) h1 = y;
  }
  printf("%d\n", (w1 - w0) * (h1 - h0));
  return 0;
}
