Walk in the Park

Time Limit: 2 Seconds    Memory Limit: 32768 KB

You are responsible for inspecting trees located in a park, to make sure they remain healthy. The location of each tree is given to you as a point in the two-dimensional plane. Due to recently-replanted grass, you are only allowed to walk through the park along a collection of paths. Each path is described by an infinite-length horizontal or vertical line in the two-dimensional plane.

You are concerned that it may not be possible to view all the trees in the park from some vantage point on a path. In particular, a tree is visible only if you can view it by standing on some path while facing perpendicular to the path. There must be no intervening tree that obstructs your view.

Input

The input file contains a single park configuration in the form:

NTREES NPATHS
X(1) Y(1)
.
.
.
X(NTREES) Y(NTREES)
PATH(1)
.
.
.
PATH(NPATHS)

NTREES and NPATHS are integers in the range [1,100000]. The integer coordinates of the trees are given on the next NTREES lines. This is followed by NPATHS lines, each of the form x=C or y=C defining a vertical or horizontal path, where C is an integer in the range [-1000000,1000000].

All coordinates are in the range -1000000 ≤ x,y ≤ 1000000. All trees are distinct and do not lie on any path, and all paths are distinct.

Output

The number of trees visible from some path.

Sample Input

6 3
-1 3
4 2
6 2
6 3
6 4
4 3
x=0
y=-1
y=5

Sample Output

5
Submit

Source: Rocky Mountain 2008