W,H,N=map(int,input().split())
xM=W
xm=0
yM=H
ym=0
for i in range(N):
    a=list(map(int,input().split()))
    if a[2]==1:
        if a[0]>xm:
            xm=a[0]
        else:
            break
    elif a[2]==2:
        if a[0]<xM:
            xM=a[0]
        else:
            break
    elif a[2]==3:
        if a[1]>ym:
            ym=a[1]
        else:
            break
    else:
        if a[1]<yM:
            yM=a[1]
        else: 
            break
xl=xM-xm
yl=yM-ym
print(xl*yl)