#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
int main(void)
{
  for(;;){
    int a,b,r;
    cin >> a >> b >> r;
    if(!a&&!b) return 0;
    int range[64]={};
    REP(i,r*4+1) REP(j,r*4+1)
      if(i*i+j*j<=16*r*r) range[i]++;
    vector<vector<int> >figx;
    figx.assign(10000,vector<int>());
    REP(i,a){
      int xa,ya;
      scanf("%d%d",&xa,&ya);
      figx[xa].push_back(ya);
    }
    REP(i,10000) SORT(figx[i]);
    int answer=0;
    REP(bul,b){
      int xb,yb;
      scanf("%d%d",&xb,&yb);
      FOR(dx,max(-r*4,-xb),min(r*4+1,10000-xb)){
	int sec=range[abs(dx)];
	int nx=xb+dx;
	if(sec)
	  answer+= upper_bound(figx[nx].begin(),figx[nx].end(),yb+sec-1)-lower_bound(figx[nx].begin(),figx[nx].end(),yb-sec+1);
      }
    }
    cout << answer << endl;
  }
}