#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long W{}, H{}, N{};
  cin >> W >> H >> N;
  long long xl{}, xr{}, yu{}, yd{};
  xr = W, yu = H;
  while (N--) {
    long long x{}, y{}, a{};
    cin >> x >> y >> a;
    switch (a) {
      case 1:
        if (x > xl) xl = x;
        break;
      case 2:
        if (x < xr) xr = x;
        break;
      case 3:
        if (y > yd) yd = y;
        break;
      case 4:
        if (y < yu) yu = y;
        break;
    }
  }
  long long l = xr - xl;
  l = max(l, 0LL);
  long long b = yu - yd;
  b = max(b, 0LL);
  cout << l * b << endl;
  return 0;
}
