#include <bits/stdc++.h>
using sll = signed long long;
struct zxc {
  sll x, y;
  size_t a;
  zxc(sll x_ = 0, sll y_ = 0, size_t a_ = 0) : x(x_), y(y_), a(a_) {}
};
int main() {
  sll W, H;
  size_t N;
  std::cin >> W >> H >> N;
  sll x1{0}, y1{0}, x2{W}, y2{H};
  for (size_t i{0}; i < N; i++) {
    zxc z;
    std::cin >> z.x >> z.y >> z.a;
    if (z.a == 1) {
      x1 = std::max(x1, z.x);
    }
    if (z.a == 2) {
      x2 = std::min(x2, z.x);
    }
    if (z.a == 3) {
      y1 = std::max(y1, z.y);
    }
    if (z.a == 4) {
      y2 = std::min(y2, z.y);
    }
  }
  signed result = 0;
  if (((x2 - x1) > 0) && ((y2 - y1) > 0)) {
    result = (x2 - x1) * (y2 - y1);
  }
  if (result <= 0) {
    std::cout << 0 << "\n";
  } else {
    std::cout << result << "\n";
  }
  return 0;
}
