#include <bits/stdc++.h>
int main(void) {
  int W, H, N;
  int s[101][4];
  int i, j;
  int tateu, tates, yokom, yokoh;
  int menseki;
  scanf("%d %d %d", &W, &H, &N);
  for (i = 0; i < N; i++)
    for (j = 0; j < 3; j++) scanf("%d", &s[i][j]);
  tateu = H;
  tates = 0;
  yokom = W;
  yokoh = 0;
  for (i = 0; i < N; i++) {
    switch (s[i][2]) {
      case 1:
        if (s[i][0] > yokoh)
          ;
        yokoh = s[i][0];
        break;
      case 2:
        if (yokom > s[i][0])
          ;
        yokom = s[i][0];
        break;
      case 3:
        if (s[i][1] > tates)
          ;
        tates = s[i][1];
        break;
      case 4:
        if (tateu > s[i][1])
          ;
        tateu = s[i][1];
        break;
    }
  }
  menseki = (yokom - yokoh) * (tateu - tates);
  if (((yokom - yokoh) > 0) && ((tateu - tates) > 0))
    printf("%d\n", menseki);
  else
    printf("0\n");
  return 0;
}
