#include <bits/stdc++.h>
using namespace std;
const int kMax = 100;
int main() {
  int w, h, n;
  bool region[kMax][kMax] = {};
  cin >> w >> h >> n;
  int x, y, a;
  int x_0, x_1, y_0, y_1;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> a;
    if (a == 1) {
      x_0 = 0;
      x_1 = x;
      y_0 = 0;
      y_1 = h;
    } else if (a == 2) {
      x_0 = x;
      x_1 = w;
      y_0 = 0;
      y_1 = h;
    } else if (a == 3) {
      x_0 = 0;
      x_1 = w;
      y_0 = 0;
      y_1 = y;
    } else if (a == 4) {
      x_0 = 0;
      x_1 = w;
      y_0 = y;
      y_1 = h;
    }
    for (int j = x_0; j < x_1; j++) {
      for (int k = y_0; k < y_1; k++) {
        region[j][k] = true;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < h; j++) {
      if (region[i][j] == false) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
