#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1.0);
int a[N][N];
int main() {
  std::ios::sync_with_stdio(false);
  int w, h, n;
  cin >> w >> h >> n;
  int ss = h, xx = 0, zz = 0, yy = w;
  for (int i = 1; i <= n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      zz = max(zz, x);
    }
    if (a == 2) {
      yy = min(yy, x);
    }
    if (a == 3) {
      xx = max(xx, y);
    }
    if (a == 4) {
      ss = min(ss, y);
    }
  }
  if (ss <= xx || yy <= zz)
    cout << 0 << endl;
  else
    cout << (ss - xx) * (yy - zz) << endl;
  return 0;
}
