#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <queue>
using namespace std;
#define SZ(v) ((int)(v).size())
#define SQR(x) ((x) * (x))
const int maxint = -1u>>1;
typedef long long lint;

struct P {
    int x, y;
    void input() {
        scanf("%d%d", &x, &y);
    }
    lint dist(const P &a) const {
        return SQR(lint(a.x - x)) + SQR(lint(a.y - y));
    }
};

const int maxn = 100000 + 100;
int n1, n2, r;
map<pair<int, int>, vector<P> > mm;
P p1[maxn], p2[maxn];

pair<int, int> calc_pos(const P &pt) {
    int x = pt.x / (r * 4), y = pt.y / (r * 4);
    return make_pair(x, y);
}
int main() {
    while (scanf("%d%d%d", &n1, &n2, &r) && (n1 + n2)) {
        for (int i = 0; i < n1; ++i) {
            p1[i].input();
        }
        mm.clear();
        for (int j = 0; j < n2; ++j) {
            p2[j].input();
            pair<int, int> pos = calc_pos(p2[j]);
            mm[pos].push_back(p2[j]);
        }
        
        lint ans = 0;
        for (int i = 0; i < n1; ++i) {
            pair<int, int> pos = calc_pos(p1[i]);
            for (int dx = -1; dx <= 1; ++dx) {
                for (int dy = -1; dy <= 1; ++dy) {
                    pair<int, int> p = make_pair(pos.first + dx, pos.second + dy);
                    if (mm.find(p) == mm.end()) continue;
                    const vector<P> &v = mm[p];
                    for (int k = 0; k < SZ(v); ++k) {
                        if (p1[i].dist(v[k]) <= SQR(4 * r)) {
                            ++ans;
                        }
                    }
                }
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}