w, h, n = list(map(int,input().split()))

init_w, init_h, init_w2, init_h2 = 0,0,w,h
for i in range(n):
  x, y, a = list(map(int,input().split()))
  
  if a ==1:
    init_w = x
  elif a==2:
    init_w2 = x
  elif a==3:
    init_h = y
  elif a==4:
    init_h2 = y

area = (init_w2-init_w)*(init_h2-init_h)
if area<=0:
  area = 0
print(area)


