Polly the Parrot is sitting at the top of her favorite tree
in Manhattan. In Manhattan, the roads are either avenues; going
north to south, or streets; going east to west. The avenues are
numbered , , , and so on, from east to west,
with avenue being the
easternmost one. The streets are numbered , , , etc, from south to north, with
street being the
southernmost one. Polly thinks that the New Yorkers were not
very creative in naming their roads, but at least this naming
convention makes for a convenient coordinate system.
Polly has friends
that live in different parts of the city. Friend is known to never leave the
neighborhood between avenue and ,
and between the streets and .
Every now and then, Polly hears a call for help from one of her
friends. Based on how loud the call is, Polly is able to
precisely determine that the manhattan distance from her tree
to the friend who is calling (in Manhattan the buildings are so
tall that even sound travels along the streets and avenues).
Polly doesn’t care enough to actually go help, but she is
interested in how many different friends the call could be
coming from. This is what she is asking you to help her with.
That, and a cracker.
Input
The first input line contains two positive integers
and : the number of friends Polly has,
and the number of calls for help she heard. The second line
contains two values
and : the position
of the tree where she is sitting.
Then follow lines
that describe the neighborhoods her friends frequent. The
’th line describes the
neighborhood of friend
by specifying and . Finally there are lines that describe the calls for
help. Each line
contains a single non-negative integer , how far from Polly in
Manhattan distance the call originated from.
We always have . Further, all coordinates are integers and
between and
, and all distances
are integers between
and .
Output
For each call for help, output the number of friends the
call for help could be coming from.
Sample Input 1 |
Sample Output 1 |
6 13
1 4
0 7 1 6
3 5 0 3
0 1 3 2
4 6 5 3
8 7 7 4
8 0 7 2
0
1
2
3
4
5
6
7
8
9
10
11
12
|
1
1
3
4
3
2
2
1
2
2
2
1
0
|