Neighbours

No attempts yetTime limit2sMemory limit64 MB

Problem

The Great Bytean Mountains occupy a rectangle in the Cartesian plane whose opposite corners are (0,0)(0, 0) and (w,h)(w, h), where ww and hh are positive integers. Inside the rectangle there are nn mountain peaks, each located at a grid point (a point with integer coordinates).

Tourists want to build houses on grid points. The park rules are strict: at most one house may stand on each grid point, and no house may be built on a peak. There are therefore (w+1)(h+1)n(w + 1)\cdot(h + 1) - n possible house locations.

Some locations are better than others. A grid point (x,y)(x, y) that is not a peak has a northern neighbour if there is a peak at (x,y+d)(x, y + d) for some positive integer dd. Southern, eastern, and western neighbours are defined analogously — a peak in the same column below it, or in the same row to its east or west. Every non-peak grid point thus has between 00 and 44 neighbours, and the more neighbours it has, the better the view.

Count how many non-peak grid points have exactly 00, 11, 22, 33, and 44 neighbours.

Input

The first line contains three integers ww, hh, and nn (1w,h1091 \le w, h \le 10^9, 1n5000001 \le n \le 500\,000), separated by single spaces. Each of the following nn lines contains two integers xx and yy (0xw0 \le x \le w, 0yh0 \le y \le h), separated by a single space, giving the location of one peak. All peaks are at distinct grid points.

Output

Print five integers separated by single spaces: the numbers of non-peak grid points that have exactly 00, 11, 22, 33, and 44 neighbours, in that order.

Note

In the example, the non-peak points with exactly two neighbours are (3,1)(3, 1) and (3,3)(3, 3); those with three neighbours are (1,1)(1, 1), (0,2)(0, 2), and (1,3)(1, 3); the point (2,2)(2, 2) has four neighbours; the point (4,0)(4, 0) has none; and every remaining non-peak point has exactly one neighbour.