h, w = map(int, input().split())
n = int(input())

kovrs = []

for i in range(n):
    a, b = map(int, input().split())
    kovrs.append((a, b))

kovrs.sort(key=lambda x: (-x[0], -x[1]))  # Sort the carpets in decreasing order of both dimensions

max_area = 0  # Maximum total area
total_area = 0  # Total area of laid carpets
x, y = h, w  # Remaining free space on the showcase

for a, b in kovrs:
    if x >= a and y >= b:  # Check if the carpet fits in the remaining space
        total_area += a * b
        max_area = max(max_area, total_area)
        x = min(x - a, a)
        y = w  # Remaining space in the width

total_area += x * y  # Area of the remaining free space
max_area = max(max_area, total_area)

print(max_area)
