#include <bits/stdc++.h>
using namespace std;
int main() {
  long long W, H, N;
  cin >> W >> H >> N;
  long long l = 0, r = W, b = 0, t = H;
  long long x, y, a;
  for (int i = 0; i < N; i++) {
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        if (l < x) l = x;
        break;
      case 2:
        if (r > x) r = x;
        break;
      case 3:
        if (b < y) b = y;
        break;
      case 4:
        if (t > y) t = y;
        break;
    }
  }
  cout << (r - l) * (t - b) << endl;
  return 0;
}
