Number of Peanuts

No attempts yetTime limit1sMemory limit128 MB

Problem

A large old tree stands in the middle of a forest. A squirrel named Darami lives inside a hollow in that tree, and every day she takes a walk through the forest in a very peculiar way.

Darami starts from the old tree facing north, and every second she acts according to the following rules:

  • If there is a peanut under her feet, she picks it up, turns 90 degrees to the right, and moves forward 1 m.
  • If there is no peanut under her feet, she puts down one peanut where she stands, turns 90 degrees to the left, and moves forward 1 m.

Darami is so fast that she moves exactly 1 m every second, and so strong that she never runs out of peanuts to carry. Find the number of peanuts lying on the ground after tt seconds.

Input

The first line contains the number of peanuts nn (0n70 \le n \le 7) lying on the ground at the moment Darami leaves the tree (second 0).

Each of the next nn lines contains the position of one peanut as two integers xx and yy (2x,y2-2 \le x, y \le 2), separated by a space. This means the peanut is located xx meters to the east and yy meters to the south of the starting point. At most one peanut lies at any single position.

The last line contains the integer tt (0t1090 \le t \le 10^9), the number of seconds Darami walks.

Output

Print, on the first line, the number of peanuts lying on the ground after tt seconds.