#include<iostream>

using namespace std;

int main(){
  int W , H , N;

  cin >> W >> H >> N ;
  
  int WWL = 0 , WWR = W , WHU = 0 , WHO = H;
  for(int i = 0 ; i < N ; i++){
    int x , y , a;
    cin >> x >> y >> a;
    switch(a):
      case(1){
        if(WWL > x)
          WWL = x;
        break;
      }
      case(2){
        if(WWR < x)
          WWR = x;
        break;
      }
      case(3){
        if(WHU > y)
          WHU = y;
        break;
      }
      case(4){
        if(Who < y)
          WHO = y;
        break;
      }
    //cout << "xa=" << WWL << " xb=" << WWR << " ya=" << WHU << " yb =" << WHO << endl; 
  }
  
  int men = (WWR - WWL) *  (WHO - WHU);
  if ((WWR - WWL) < 0 || (WHO - WHU)<0)
    men = 0;
  cout << men << endl;
  
  return 0;
}