Ant Town

Time limit1sMemory limit128 MB

Problem

Hard-working ants built Ant Town as a Manhattan-like grid. The town has H horizontal streets and V vertical streets, and every crossing of the two kinds of streets is an intersection.

Ants dislike rain. When rain starts, each ant standing on an intersection runs along the streets to the nearest intersection that has an umbrella. The town authorities placed umbrellas on N intersections, and any number of ants may hide under one umbrella.

If an ant has two or more nearest umbrella intersections at the same minimum distance, it panics, stays at its starting intersection, and gets wet. Such starting intersections are called wet intersections.

The figure below shows a town with 10 horizontal streets, 10 vertical streets, and 4 umbrella intersections. The question marks are wet intersections.

Vertical streets are numbered from 1 to V from left to right, and horizontal streets are numbered from 1 to H from bottom to top.

Given the umbrella locations, determine the number of wet intersections in Ant Town.

Input

The first line contains two integers H and V: the number of horizontal streets and the number of vertical streets. 1 ≤ H, V ≤ 30000.

Horizontal streets are numbered from 1 to H, and vertical streets are numbered from 1 to V.

The second line contains an integer N, the number of intersections with umbrellas. 1 ≤ N ≤ 10.

Each of the next N lines contains two integers h and v, meaning that there is an umbrella at the intersection of horizontal street h and vertical street v. All umbrella locations are distinct.

Output

Output the number of wet intersections in Ant Town.