eolymp
bolt
Try our new interface for solving problems
Problems

Covering

Covering

A large rectangle with sides parallel to the coordinate axes is given, which non-adjacent vertices are the points (0, 0) and (n, m). It contains k smaller rectangles, also with sides parallel to the coordinate axes, which are given by non-adjacent vertices. The coordinates of the i-th rectangle are non-negative integer values (ai, bi) and (ci, di).

Find the area of the largest rectangle that is not covered by the inscribed rectangles.

Input

The first line contains the values n, m, k (1n, m10000, 1 * ≤ *k100), specifying the dimension of the large rectangle and the number of inscribed rectangles, respectively.

The next k lines contain the coordinates of the inscribed rectangles (0ai, cin, 0bi , dim).

Output

Print the area of the largest rectangle that will remain uncovered by the inscribed rectangles.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 3 2
1 0 2 3
0 3 3 2
Output example #1
4