W,H,N=map(int,input().split())
A = []
B = []
C = []
D = []
 
for i in range(N):
  x,y,a = map(int,input().split())
  if a == 1:
    A.append(x)
  elif a == 2:
    x = W-x
    B.append(x)
  elif a == 3:
    C.append(y)
  else:
    y = H-y
    D.append(y)
if len(A)>0:
    a = max(A)
else:
    a=0
 
if len(B)>0:
    b = max(B)
else:
    b = 0
 
if len(C)>0:
    c = max(C)
else:
    c = 0
if len(D)>0:
    d = max(D)
else:
    d = 0
 
w = W - (a+b)
h = H - (c+d)
if w*h<=0:
    print(0)
else:
    print(w*h)