#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, h, n;
  cin >> w >> h >> n;
  pair<int, int> cw, ch;
  cw.first = 0;
  cw.second = w;
  ch.first = 0;
  ch.second = h;
  int x, y, a;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        if (cw.first < x and x < cw.second)
          cw.first = x;
        else if (cw.second <= x)
          cw.second = cw.first;
        break;
      case 2:
        if (cw.first < x and x < cw.second)
          cw.second = x;
        else if (cw.first >= x)
          cw.first = cw.second;
        break;
      case 3:
        if (ch.first < y and y < ch.second)
          ch.first = y;
        else if (ch.second <= y)
          ch.second = ch.first;
        break;
      case 4:
        if (ch.first < y and y < ch.second)
          ch.second = y;
        else if (ch.first >= y)
          ch.first = ch.second;
        break;
    }
  }
  if (ch.second == ch.first or cw.second == cw.first)
    cout << 0 << endl;
  else
    cout << (ch.second - ch.first) * (cw.second - cw.first) << endl;
}
