W,H,N = int(input())
p = 0
q = W
l = 0
m = H

for i in range(N):
  x,y,a = map(int.split())
  if a == 1:
    p = max(p,x)
  if a == 2:
    q = min(q,x)
  if a == 3:
    l = max(l,y)
  if a == 4:
    m = min(m,y)
S = (q-p)*(l-m)
print(S)
    
  
