w, h, n = list(map(int, input().split()))
xya = []
for i in range(n):
    xya.append(list(map(int, input().split())))

min_x_1 = w
max_x_2 = 0
min_y_3 = h
max_y_4 = 0
for i in range(n):
    ai = xya[i][2]
    if ai == 1:
        if xya[i][0] < min_x_1:
            min_x_1 = xya[i][0]
    if ai == 2:
        if xya[i][0] > max_x_2:
            max_x_2 = xya[i][0]
    if ai == 3:
        if xya[i][1] < min_y_3:
            min_y_3 = xya[i][1]
    if ai == 4:
        if xya[i][1] > max_y_4:
            max_y_4 = xya[i][1]

x = max_x_2 - min_x_1
if x <= 0:
    print("0")
else:
    y = max_y_4 - min_y_3
    if y <= 0:
        print("0")
    else:
        print(str(x * y))
