There are bishops placed on a chessboard with lines and columns. As we know from the game of chess, the bishops attack only on the diagonals.
A position from the chessboard is considered safe if it's not attacked by any of the bishops on the board.
Task
Write a program which finds the number of safe positions on the chessboard.
Input data
The input file nebuni.in
contains on the first line the integers and , separated by a space, which represent the dimensions of the chessboard, as well as the number of bishops on the chessboard. On the next lines we have the positions (line and column, separated by a space) of the bishops, each bishop's place is on a different line of the file.
Output data
The output file nebuni.out
will contain a single line where a single integer will be written, representing the number of safe positions on the given chessboard.
Constraints and clarifications
- The lines and columns are numbered from to .
- For of the test cases, .
- For of the test cases, .
Example
nebuni.in
5 4
2 1
1 3
4 2
5 2
nebuni.out
6
Explanation
There are bishops on the chessboard.
The positions attacked by the bishops are colored in gray.