#include<iostream>
using namespace std;
int main(){
  int x,y,w,h,n,tx,ty,cnt,i;
  cin>>x;
  while(cin>>x>>y>>w>>h>>n){
    cnt=0;
    while(n--){
      cin>>tx>>ty;
      if (x<=tx&&tx<=x+w&&y<=ty&&ty<=y+h)cnt++;
    }
    cout <<cnt<< endl;
  }
}