w,h,n = map(int,input().split())
x_min = 0
y_min = 0
x_max = w
y_max = h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    if x_min < x:
      x_min = x
  elif a == 2:
    if x_max > x:
      x_max = x
  elif a == 3:
    if y_min < y:
      y_min = y
  elif a == 4:
    if y_max > y:
      y_max = y
S = (x_max-x_min)*(y_max-y_min)
if S < 0:
  print(0)
else:
  print(S)
