#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  int x[n], y[n], a[n];
  int b = 0, c = w, d = 0, e = h;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> a[i];
    if (a[i] == 1)
      b = max(x[i], b);
    else if (a[i] == 2)
      c = min(x[i], c);
    else if (a[i] == 3)
      d = max(y[i], d);
    else
      e = min(y[i], e);
  }
  cout << max(0, abs(c - b) * abs(e - d)) << endl;
}
