#include <bits/stdc++.h>
using namespace std;
int main() {
  int xx1 = 0, xx2 = 0, yy1 = 0, yy2 = 0;
  int W, H, N;
  int x, y, a;
  cin >> W >> H >> N;
  xx2 = W;
  yy2 = H;
  for (int i = 0; i < N; ++i) {
    cin >> x >> y >> a;
    if (a == 1) {
      xx1 = max(xx1, x);
    } else if (a == 2) {
      xx2 = min(xx2, x);
    } else if (a == 3) {
      yy1 = max(yy1, y);
    } else if (a == 4) {
      yy2 = min(yy2, y);
    }
  }
  cout << ((yy2 - yy1) * (xx2 - xx1) <= 0 ? 0 : (yy2 - yy1) * (xx2 - xx1))
       << endl;
}
