#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,w,h,t;
  cin>>t;
  while(t--){
    int n,a,b,ans=0;
    cin>>x>>y>>w>>h>>n;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      if(x<=a&&a<=x+w&&y<=b&&b<=y+h)ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}