#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
struct Edge {
  int from, to;
  int cost;
  bool operator<(const Edge& e) const { return cost < e.cost; }
  bool operator>(const Edge& e) const { return cost > e.cost; }
};
void add_edge(vector<vector<Edge> >& g, int from, int to, int cost) {
  g[from].push_back(Edge{from, to, cost});
}
int main() {
  long long int w, h, n;
  cin >> w >> h >> n;
  long long int l = 0, r = w, d = 0, u = h;
  while (n--) {
    long long int a, b, c;
    cin >> a >> b >> c;
    if (c == 1)
      l = max(a, l);
    else if (c == 2)
      r = min(a, r);
    else if (c == 4)
      d = max(b, d);
    else
      u = min(b, u);
  }
  cout << max(0LL, (r - l) * (u - d)) << endl;
}
