/*
 * Author: OldY
 * Created Time:  2011/8/31 16:30:04
 * File Name: E.cpp
 */
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;
const int maxint = -1u>>1;
const double pi = acos(-1.0);
typedef long long lint;

const int maxn = 10000 + 10;

int n,m,r;
vector <int> point[maxn];
int cirx[10*maxn] , ciry[10*maxn];
int tmpx,tmpy;
lint ans;
int top,y,nowx,nowy;

int find(const int & x , const int & i){
    int sz = point[i].size();
    int l = 0 , r = sz - 1 , mid;
    while(l <= r){
        mid = ((l+r) >> 1);
        if(mid < 0 || mid >= sz) break;
        if(point[i][mid] <= x)
            l = mid + 1;
        else r = mid - 1;
    }
    return l - 1;
}

int main() {
    while(scanf("%d%d%d",&n,&m,&r)){
        if(n == 0 && m == 0) break;
        ans = 0;
        top = 16*r*r;
        for(int i = 0 ; i < maxn ; i++)
            point[i].clear();
        for(int i = 0 ; i < n ; i++)
            scanf("%d%d",cirx+i,ciry+i);
        for(int i = 0 ; i < m ; i++){
            scanf("%d%d",&tmpx,&tmpy);
            point[tmpx].push_back(tmpy);
        }
        for(int i = 0 ; i < 10000 ; i++)
            sort(point[i].begin() , point[i].end());
        for(int i = 0 ; i < n ; i++){
            y = 0;
            for(int x = 4*r ; x >= 0 ; x--){
                while(x*x+y*y <= top) y++;
                y--;
                nowx = cirx[i] - x;
                if(nowx >= 0){
                    ans += find(ciry[i]+y,nowx) - find(ciry[i]-y-1, nowx);
                }
                if(x == 0) break;
                nowx = cirx[i] + x;
                if(nowx < 10000){
                    ans += find(ciry[i]+y,nowx) - find(ciry[i]-y-1 , nowx);
                }
            }
        }
        printf("%lld\n",ans);
    }   
    return 0;
}