In Rainyville, it rains quite a lot. Despite residents getting used to the frequent rain, they still would rather avoid it when walking outside. The side view of a sidewalk (the view as if you were facing the sidewalk from across the street) can be represented by an
In the diagram, the blue cells represent rain, black represent blocks, and white represent cells safe from the rain. In this example, there is a 6 by 5 grid with blocks at
Given the blocks in a side view grid of a sidewalk, determine the number of cells that are safe from the rain.
Constraints
It is guaranteed that each blocked cell will be unique.
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints
Input Specification
The first line will contain integers
The next
It is guaranteed that each cell will be unique.
Output Specification
On a single line, output the number of cells that are safe from the rain.
Sample Input 1
6 5 6
0 2
1 4
2 0
2 3
3 1
5 2
Sample Output 1
11
Explanation for Sample Output 1
This is the sample case described in the problem statement.
Sample Input 2
8 8 8
7 6
2 4
5 3
1 1
6 1
3 2
6 4
0 5
Sample Output 2
24
Comments