w, h, n = map(int, input().split())
W = [0, w]
H = [0, h]
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        if W[0] < x:
            W[0] = x
    elif a == 2:
        if W[1] > x:
            W[1] = x
    elif a == 3:
        if H[0] < y:
            H[0] = y
    else:
        if H[1] > y:
            H[1] = y
if W[0] > W[1] or H[0] > H[1]:
    print(0)
else:
    print((W[1] - W[0]) * (H[1] - H[0]))