Neptune is questing in a certain online role-playing game. The game is played on a tiled plane where each tile is a square of unit dimensions and is defined as the top-left corner of the plane. This game has theme music that is unlocked when visiting the interior of any of the rectangular regions in the game (one song per region). A region is defined by an pair, the top left corner of a rectangle that is units wide and units long. Being on the edge of a rectangular region counts as visiting it. Each song may only be unlocked once.
This game also has the concept of magic, so Neptune will teleport times to a given set of coordinates.
How many songs will he unlock?
Input Specification
The first line will contain 2 space-separated integers and .
The next lines will each define a region where music may be unlocked as 4 space-separated integers , , , and .
Finally, the next lines will each contain a pair of coordinates: the locations Neptune will teleport to in chronological order.
Output Specification
The number of songs Neptune will unlock, on one line.
Sample Input
2 1
0 0 100 100
0 0 50 50
60 60
Sample Output
1
Comments
This comment is hidden due to too much negative feedback. Show it anyway.
Thank you, but that was clear from reading the problem.