The Dog Task

No attempts yetTime limit1sMemory limit128 MB

Problem

Hunter Bob often goes walking with his dog Ralph. Bob walks at a constant speed, and his route is a polygonal line (which may intersect itself) whose vertices are given by NN pairs of integers (Xi,Yi)(X_i, Y_i) — their Cartesian coordinates.

Ralph wanders on his own, but always meets his master at the specified NN points. The dog starts together with Bob at (X1,Y1)(X_1, Y_1) and finishes, also together with Bob, at (XN,YN)(X_N, Y_N).

Ralph can move at a speed up to twice his master's. While Bob walks in a straight line from one point to the next, the cheerful dog looks for trees, bushes, hummocks, and other interesting spots of the landscape, given by MM pairs of integers (Xj,Yj)(X'_j, Y'_j). However, after leaving his master at point (Xi,Yi)(X_i, Y_i) and before meeting him again at point (Xi+1,Yi+1)(X_{i+1}, Y_{i+1}) (where 1i<N1 \le i < N), the dog may visit at most one interesting place.

Each interesting place may be visited at most once over the whole route. Find the maximum number of interesting places that Ralph can visit while satisfying all of the above requirements.

The picture below shows an example of Bob's route (solid line), a set of interesting places (dots), and one of Ralph's best routes (dotted line).

Input

The first line contains two integers NN and MM, separated by a space (2N1002 \le N \le 100, 0M1000 \le M \le 100). The second line contains NN pairs of integers X1,Y1,,XN,YNX_1, Y_1, \dots, X_N, Y_N, separated by spaces, describing Bob's route. The third line contains MM pairs of integers X1,Y1,,XM,YMX'_1, Y'_1, \dots, X'_M, Y'_M, separated by spaces, describing the interesting places.

All points in the input are distinct, and every coordinate is an integer whose absolute value is at most 10001000.

Output

Print a single integer — the maximum number of interesting places that Ralph can visit.