#include <stdio.h>
int main(void)
{ int cx,cy,cwx,cwy,nx,ny,n,set,count;
scanf("%d",&set);
for(;set>0;set--){
count=0;
scanf("%d%d%d%d",&cx,&cy,&cwx,&cwy);
scanf("%d",&n);
for(;n>0;n--){
scanf("%d%d",&nx,&ny);
if(nx>=cx&&ny>=cy&&nx<=cx+cwx&&ny<=cy+cwy)
count++;
} printf("%d\n",count);}}