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

xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):

    if array[i][2] == 1:
        if array[i][0] > xmin:
            xmin = array[i][0]
    if array[i][2] == 2:
        if array[i][0] < xmax:
            xmax = array[i][0]
    if array[i][2] == 3:
        if array[i][1] > ymin:
            ymin = array[i][1]
    if array[i][2] == 4:
        if array[i][1] < ymax:
            ymax = array[i][1]
area = (xmax-xmin)*(ymax-ymin)
if area <= 0:
    print(0)
else:
    print(area)
