#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define N 100010
int in[N];
int ans[N];
int cnt;
int Lowbit(int t)
{
return t&(-t);
}
int Sum(int p)
{
int sum=0;
while(p>0)
{
sum+=in[p];
p-=Lowbit(p);
}
return sum;
}
void add(int p,int num)
{
while(p<=cnt)
{
in[p]+=num;
p+=Lowbit(p);
}
}
struct node
{
ll x,y;
}p[N];
bool cmp(node a,node b)
{
return a.x>b.x;
}
ll yy[N];
struct query
{
ll r1,r2;
int index;
}q[N];
bool cmp1(query a,query b)
{
return a.r1>b.r1;
}
int main()
{
ll x1,y1,x2,y2,i,j,k;
while(scanf("%lld%lld%lld%lld",&x1,&y1,&x2,&y2)!=EOF)
{
memset(in,0,sizeof(in));
int n,m;
scanf("%d",&n);
for(i=0;i<n;i++)
{
ll a,b;
scanf("%lld%lld",&a,&b);
p[i].x=(a-x1)*(a-x1)+(b-y1)*(b-y1);
p[i].y=(a-x2)*(a-x2)+(b-y2)*(b-y2);
yy[i]=p[i].y;
}
sort(p,p+n,cmp);
sort(yy,yy+n);
cnt=unique(yy,yy+n)-yy;
scanf("%d",&m);
for(i=0;i<m;i++)
{
ll a,b;
scanf("%lld%lld",&a,&b);
q[i].r1=a*a;
q[i].r2=b*b;
q[i].index=i;
}
sort(q,q+m,cmp1);
j=0;
for(i=0;i<m;i++)
{
while(j<n && p[j].x>=q[i].r1)
{
k=lower_bound(yy,yy+cnt,p[j].y)-yy+1;
add(k,1);
j++;
}
k=lower_bound(yy,yy+cnt,q[i].r2)-yy+1;
ans[q[i].index]=Sum(cnt)-Sum(k-1);
}
for(i=0;i<m;i++)
printf("%d\n",ans[i]);
}
}