#include <iostream>
using namespace std;

int main() {
    int S; cin >> S;
    while(S--) {
        int X, Y, W, H; cin >> X >> Y >> W >> H;
        int N; cin >> N;
        int res = 0;
        while(N--) {
            int x, y; cin >> x >> y;
            if(X <= x && x <= X + W && Y <= y && y <= Y + H) res++;
        }
        cout << res << endl;
    }
}