W, H, N = map(int, input().split())
plot_infos = [list(map(int, input().split())) for _ in range(N)]

def calcArea(M, H, N, plot_infos):
  pointA = [M, H]
  pointB = [0, 0]
  for i in range(N):
    plot_info = plot_infos[i]
    if plot_info[2] == 1:
      pointB[0] = max(plot_info[0], pointB[0])
    elif plot_info[2] == 2:
      pointA[0] = min(plot_info[0], pointA[0])
    elif plot_info[2] == 3:
      pointB[1] = max(plot_info[1], pointB[1])
    elif plot_info[2] == 4:
      pointA[1] = min(plot_info[1], pointA[1])
      
  if pointA[0] < pointB[0] or pointA[1] < pointB[1]:
      return 0
      
  return (pointA[0] - pointB[0]) * (pointA[1] - pointB[1])

print(calcArea(W, H, N, plot_infos))