function solution(s, n) {
let result = "";
for (let i = 0; i < s.length; i++) {
let temp;
if (s.charCodeAt(i) === 32) {
result += " ";
continue;
}
if (s[i] === s[i].toLowerCase()) {
temp = s.charCodeAt(i);
if (temp + n > 122) {
temp = 96 + (temp + n) - 122;
} else {
temp += n;
}
}
if (s[i] === s[i].toUpperCase()) {
temp = s.charCodeAt(i);
if (temp + n > 90) {
temp = 64 + (temp + n) - 90;
} else {
temp += n;
}
}
result += String.fromCharCode(temp);
}
return result;
}
import sys
sys.stdin = open('input.txt')
input = sys.stdin.readline
width, height = map(int, input().split())
x_list = list()
y_list = list()
t = int(input())
x_list.append(0)
y_list.append(0)
x_list.append(width)
y_list.append(height)
for _ in range(t):
axis, coordinate = map(int, input().split())
if axis == 1:
x_list.append(coordinate)
else:
y_list.append(coordinate)
x_list.sort()
y_list.sort()
max_x = 0
max_y = 0
for i in range(len(x_list) - 1):
max_x = max(max_x, x_list[i + 1] - x_list[i])
for j in range(len(y_list) - 1):
max_y = max(max_y, y_list[j + 1] - y_list[j])
if max_x == 0:
max_x = width
if max_y == 0:
max_y = height
print(max_x * max_y)
하루를 마치고