#include <iostream>

using namespace std;

bool between(int a, int b, int c){
	return a <= b && b <= c;
}

int main(){
	int T;
	cin >> T;
	while(T--){
		int x, y, w, h, n;
		cin >> x >> y >> w >> h >> n;
		int answer = 0;
		while(n--){
			int a, b;
			cin >> a >> b;
			if(between(x, a, x + w) && between(y, b, y + h)){ ++answer; }
		}
		cout << answer << endl;
	}
	return 0;
}
		