#include<stdio.h>
int main(){
  int l=0,r,u,d=0,n=0;
  int x,y,a;
  scanf("%d%d%d",&r,&u,&n);
  for(int i=0;i<n;i++){
    scanf("%d%d%d",&x,&y,&a);
    switch(a){
      case 1:
        (x<l)?l=x:;
        break;
      case 2:
        (r<x)?r=x:;
        break;
      case 3:
        (y<d)?d=y:;
        break;
      case 4:
        (u<y)?u=y:;
        break;
    }
  }
  if(u>d&&r>l) printf("%d\n",(u-d)*(r-l));
  else printf("0\n");
  return 0;
}
