You're running late for your favorite club because of hall traffic. Of course it's the computer club! When you finally arrive, the club has already started and you must make the all-important decision of where to sit.
The classroom can be represented by an
Naturally, you want to sit next to some of your friends, and as it happens, all
Given the coordinates
Note that a seat can only fit one person, either you or one of your friends. Please do not push your friends off of chairs.
Constraints
Input Specification
The first line of input contains three integers,
The next
Output Specification
Output a single integer, the number of seats you can sit in where you are next to at least
Sample Input
3 4 5
1 2
1 4
2 1
3 1
3 3
Sample Output
3
Explanation
The grid is shown below:
.#.#
#xx.
#x#.
Your classmates are marked by #
, and seats you can sit in that are next to at least x
.
Comments