Alice is a famous chess player. Her friend Bob wants to learn chess. So she gives him a task. The task is Alice will give him a chess board with rows and columns. There will be one very special knight in a cell on the board. Here, is the row number and is the column number. That knight is special because Alice decides how it will move. She will set two integers and . The knight will be able to move squares by row (left or right) then squares by column (up or down) or squares by column (up or down) then squares by row (left or right).
Knight can not move outside of chessboard.
There are some cells in the board which are restricted, meaning knight can not move to those cells. Now he have to find the number of different cell that the knight can visit in a single move inside the board. Rows are numbered from 1 to and columns are numbered from 1 to and top-leftmost cell is .
The picture shows all possible moves of a knight in a chess board from cell and .
No cell is restricted in the above picture.
The first line of the input contains two integers and . represents number of rows and represents number of columns of the chess board.
Second line of the input contains two integer and . represents the initial position of the Knight. Here is the row number and is the column number.
Third line contains . Details about described in the statement.
Fourth line contains integer ,number of restricted cells.
The of the next lines contains two integers and — the position of the restricted cell.
and .
and .
The initial position of the knight is not restricted.
Print the number of different cells the knight can visit in a single move.
Input | Output |
---|---|
5 5 3 2 2 2 1 1 4 | 1 |
Input | Output |
---|---|
3 4 2 2 1 1 1 1 3 | 3 |