At Carnegie Mellon University, there are often many automatic water sprayers placed on campus to water the grass.
Unfortunately, SnowballSH often gets showered (or, as he often says, attacked) by these water sprayers while casually walking to class through a piece of grass referred to as "The Mall."
The Mall can be represented by an $$$m \times n$$$ rectangular grid, with $$$k$$$ of its cells containing an automatic water sprayer.
Each automatic water sprayer can be modeled to be continuously showering all cells in its row and all cells in its column.
A cell is called safe if and only if it is not showered by any automatic water sprayer.
Please help SnowballSH determine the number of safe cells on The Mall.
The first line contains three integers $$$m$$$, $$$n$$$, and $$$k$$$ ($$$1 \le m \le 1500$$$, $$$1 \le n \le 1500$$$, $$$0 \le k \le mn$$$) — the number of rows, the number of columns, and the number of automatic water sprayers.
The $$$i$$$-th line of each of the following $$$k$$$ lines contains two integers $$$r_i$$$ and $$$c_i$$$ ($$$1 \le r_i \le m$$$, $$$1 \le c_i \le n$$$) — the row and column of the location of the $$$i$$$-th automatic water sprayer, respectively.
It is guaranteed that $$$(r_i, c_i) \ne (r_j, c_j)$$$ for all $$$i \ne j$$$.
Output a single integer — the number of safe squares on the grid.
6 7 52 23 32 56 75 5
6
1 100 11 67
0
15 135 0
2025
For the first test case, we have the following grid, where the circles represent cells with automatic water sprayers and blue diamonds represent safe cells:
For the second test case, there are no safe cells.
For the third test case, there are no automatic water sprayers, so all cells are safe.