#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int grid[N][N];
int main() {
  int r, c, n;
  scanf("%d%d", &r, &c);
  scanf("%d", &n);
  int xl, xr, yl, yr;
  xl = 0;
  yl = 0;
  xr = r, yr = c;
  for (int u = (0); u < (n); u++) {
    int x, y, t;
    scanf("%d%d", &x, &y);
    scanf("%d", &t);
    if (t == 1) {
      xl = max(xl, x);
    } else if (t == 2)
      xr = min(xr, x);
    else if (t == 3)
      yl = max(yl, y);
    else
      yr = min(yr, y);
  }
  int one = max(0, (xr - xl));
  int two = max(0, (yr - yl));
  printf("%d\n", one * two);
  return 0;
}
