/*
 * Author: Dumbear
 * Created Time:  2011/8/31 13:31:27
 * File Name: E.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
#define out(v) cerr << #v << ": " << (v) << endl
#define SZ(v) ((int)(v).size())
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

int n, m, r, xa[100010], ya[100010], xb[100010], yb[100010];
vector<double> vec[10010];

bool solve();

int main() {
    while (solve());
    return 0;
}

bool solve() {
    scanf("%d%d%d", &n, &m, &r);
    if (n == 0 && m == 0 && r == 0)
        return false;
    for (int i = 0; i < n; ++i)
        scanf("%d%d", &xa[i], &ya[i]);
    for (int i = 0; i <= 10000; ++i)
        vec[i].clear();
    for (int i = 0; i < m; ++i) {
        scanf("%d%d", &xb[i], &yb[i]);
        vec[xb[i]].push_back((double)yb[i]);
    }
    for (int i = 0; i <= 10000; ++i)
        sort(vec[i].begin(), vec[i].end());
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x1 = xa[i] - 4 * r, x2 = xa[i] + 4 * r;
        for (int j = x1; j <= x2; ++j) {
            double d = sqrt(abs((4.0 * r) * (4.0 * r) - (double)(j - xa[i]) * (j - xa[i])));
            double y1 = ya[i] - d, y2 = ya[i] + d;
            ans += upper_bound(vec[j].begin(), vec[j].end(), y2 + 1e-8) - lower_bound(vec[j].begin(), vec[j].end(), y1 - 1e-8);
        }
    }
    printf("%d\n", ans);
    return true;
}