#include <bits/stdc++.h>

using namespace std;

int main()
{
    int T;
    
    scanf("%d", &T);
    
    while (T--){
        int x, y, w, h;
        
        scanf("%d %d %d %d", &x, &y, &w, &h);
        
        int n;
        
        scanf("%d", &n);
        
        int ans = 0;
        
        for (int i = 0; i < n; i++){
            int a, b;
            scanf("%d %d", &a, &b);
            
            ans += (x <= a && a <= x + w && y <= b && b <= y + h);
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}