cho.sh
Notes
Loading...

Hockey

Time limit

2s

Memory limit

128 MB

Problem

Minsik Corporation received an urgent request from the International Ice Hockey Federation (IIHF). They needed a system that sounds an alarm when too many players from the same team are on the rink. The system works in three steps.

  1. A digital camera takes a picture of the rink every second.
  2. The positions of all players are extracted from the picture.
  3. The number of players from the same team inside the hockey rink is computed.

The hockey rink is the union of a central rectangle and two circular end regions. The rectangle has lower-left corner (X, Y) and size W * H. Let r = H / 2. The left circle has center (X, Y + r), the right circle has center (X + W, Y + r), and both circles have radius r.

Given the players' coordinates, determine how many players are inside the rink or on its boundary.

Input

The first line contains integers W H X Y P. P is the number of players.

W and H are positive integers at most 100, and H is even. X and Y are integers whose absolute values are at most 100. P is a positive integer at most 50.

Each of the next P lines contains one player's coordinates x y. The absolute value of each coordinate is at most 300.

Output

Print the number of players who are inside the rink or on its boundary.