#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){
	
	int m,n;
	int x,y,W,H;
	int X,Y;
	
	cin>>m;
	
	while(m>0){
		cin>>x>>y>>W>>H;
		cin>>n;
		int s=0;
		vector< vector<int> >c(n,vector<int>(2));
		for(int i=0;i<n;i++){
			cin>>X>>Y;
			if(x<=X&&X<=x+W&&y<=Y&&Y<=(y+H))
				s++;
			}
	
		cout<<s<<endl;
		m--;
	}
	
	
	
	
	
}