cho.sh
Notes
Loading...

Her Heart

Time limit

2s

Memory limit

128 MB

Problem

Sanggeun and Jungin want to know which of them a person will like in the end.

The person starts walking from some integer coordinate on an infinite two-dimensional grid. Each step moves to one of the four adjacent coordinates, and the person's preference changes after every step. At the starting coordinate the person likes Sanggeun; after one step the person likes Jungin, after two steps Sanggeun again, and so on.

Some coordinates contain obstacles. The person cannot stand on or pass through an obstacle. For each starting coordinate, assume the person moves to the origin (0, 0) along a shortest path that avoids obstacles. Starting coordinates that cannot reach the origin, or whose shortest valid path needs more than S steps, are not counted.

With the number of steps limited to at most S, count how many starting coordinates make the person like Sanggeun on arrival at the origin, and how many make the person like Jungin.

Input

The first line contains the number of obstacles B and the maximum number of steps S. The constraints are 0 <= B <= 10000 and 1 <= S <= 10000000.

Each of the next B lines contains the coordinates x and y of one obstacle. Every obstacle satisfies |x| < 1000 and |y| < 1000.

Output

Print two integers separated by a space: the number of starting coordinates that make the person like Sanggeun, and the number that make the person like Jungin.