#include <bits/stdc++.h>
int main() {
  int W, H, N;
  std::cin >> W >> H >> N;
  int region[4];
  region[0] = 0;
  region[1] = W;
  region[2] = 0;
  region[3] = H;
  for (int i = 0; i < N; i++) {
    int x, y, a;
    std::cin >> x >> y >> a;
    if (a == 1) region[0] = std::max(region[0], x);
    if (a == 2) region[1] = std::min(region[1], x);
    if (a == 3) region[2] = std::max(region[2], y);
    if (a == 4) region[3] = std::min(region[3], y);
  }
  int area = std::max((region[1] - region[0]) * (region[3] - region[2]), 0);
  std::cout << area << std::endl;
  return 0;
}
