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?
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.
The number of songs Neptune will unlock, on one line.
2 1 0 0 100 100 0 0 50 50 60 60