#import <stdio.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
int main() {
    @autoreleasepool {
        int W,H,N;
        scanf("%d %d %d", &W,&H,&N);
        int minX = 0;
        int minY = 0;
        int maxX = W;
        int maxY = H;
        for (int i=0; i<N; i++){
            int x,y,a;
            scanf("%d %d %d", &x,&y,&a);
            switch (a) {
                case 1:
                    minX = MAX(minX, x);
                    break;
                case 2:
                    maxX = MIN(maxX, x);
                    break;
                case 3:
                    minY = MAX(minY, y);
                    break;
                case 4:
                    maxY = MIN(maxY, y);
                    break;
                default:
                    break;
            }
        }
        W = MAX(maxX - minX,0);
        H = MAX(maxY - minY,0);
        printf("%d", W*H);
    }
}
