eolymp
bolt
Try our new interface for solving problems
Problems

Defense of a Kingdom

Defense of a Kingdom

Time limit 1 second
Memory limit 128 MiB

Theodore implements a new strategy game "Defense of a Kingdom". On each level player defends the Kingdom that is represented by a rectangular grid of cells. The player builds crossbow towers in some cells of the grid. The tower defends all the cells in the same row and the same column. No two towers share a row or a column.

The penalty of the position is a number of cells in the largest undefended rectangle. For example, the position shown on the picture has penalty 12.

prb2261

Help Theodore write a program that calculates the penalty of the given position.

Input data

The first line contains three integer numbers: w - width of the grid, h - height of the grid and n - number of crossbow towers (1w, h40000; 0nmin(w, h)).

Each of the following n lines contains two integer numbers x[i] and y[i] - the coordinates of the cell occupied by a tower (1x[i]w; 1y[i]h).

Output data

Output a single integer number - the number of cells in the largest rectangle that is not defended by the towers.

Examples

Input example #1
15 8 3
3 8
11 2
8 6
Output example #1
12
Author Georgiy Korneev
Source 2010 ACM NEERC, Northern Subregion, St. Petersburg, October 30, Problem D