a = input().split()
w = int(a[0])
h = int(a[1])
n = int(a[2])

x_min = 0
x_max = w
y_min = 0
y_max = h

for i in range(n):
    a = input().split()
    wp = int(a[0])
    hp = int(a[1])
    ap = int(a[2])
    if ap == 1:
        if x_min < wp:
            x_min = wp
    elif ap == 2:
        if x_max > wp:
            x_max = wp
    elif ap == 3:
        if y_min < hp:
            y_min = hp
    elif ap == 4:
        if y_max > hp:
            y_max = hp
    # print(x_min, x_max, y_min, y_max)

if x_max < x_min:
    ws = 0
else:
    ws = x_max - x_min

if y_max < y_min:
    hs = 0
else:
    hs = y_max - y_min

squea = ws * hs

print(squea)
