x,y,n=list(map(int,input().split()))
xx=x
yy=y
S=[]
a1=0
b1=0
for _ in range(n):
    S.append(list(map(int,input().split())))
for a in S :
    if a[2]==1:
        a1 = max(a1,a[0])
    elif a[2]==2:
        xx = min(xx,a[0])
    elif a[2]==3:
        b1 = max(b1,a[1])
    elif a[2]==4:
        yy = min(yy,a[1])

if(xx-a1)*(yy-b1)<0 or xx< 0 <yy or xx> 0 >yy:
  print((xx-a1)*(yy-b1) if xx<a1 and yy<b1 else 0)