Flippers is playing Othello with Desdemona, but with a twist. He wants to win.
Othello is played on a by board with pieces that are black on one side and white on the other. Initially, the entire board is black. Flippers decides to be white, and Desdemona is black. Players execute moves in the form x y w h
, meaning that they flip all pieces inside rectangle with the top left vertex at , provided they are not .
In this twisted Othello game, there is an square in the form X Y L
somewhere in the grid, denoting a square of side lengths with the top left vertex at . Pieces inside this square cannot be flipped. In other words, they will stay black so as to give Desdemona an advantage.
In total, Flippers and Desdemona played moves. However, they don't know what the board looks like! Given the moves, please help them determine the number of white pieces and the number of black pieces on the board.
Constraints
Input Specification
The first line will contain integers and .
The second line will contain , , and ,
The next lines will contain integers , , , ,
Output Specification
Output the number of black pieces and white pieces after moves, separated by a space.
Sample Input 1
6 1
2 3 3
3 1 3 4
Sample Output 1
28 8
Sample Explanation 1
Here is what the grid looks like:
Sample Input 2
10 4
1 3 4
5 4 1 5
1 0 5 8
7 6 3 3
5 5 5 5
Sample Output 2
65 35
Sample Explanation 2
Here is what the grid looks like:
Comments