#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
#define debug(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

const int FIELD_SIZE = 10000;

int main(){
	int an, bn, r;
	while(cin >> an >> bn >> r, an|bn){
		vector<vi> ay(FIELD_SIZE);
		rep(i, an){
			int x, y;
			cin >> x >> y;
			ay[x].push_back(y);
		}

		rep(i, FIELD_SIZE) sort(all(ay[i]));

		int R = 4*r;
		int RR = 16*r*r;
		int ans = 0;
		rep(i, bn){
			int bx, by;
			cin >> bx >> by;

			for(int dx = -R; dx <= R; dx++){
				int nx = bx+dx;
				if(nx < 0) dx = -bx, nx = 0;
				if(nx > FIELD_SIZE) break;
				int dy = sqrt((double)RR-dx*dx);
				ans += upper_bound(all(ay[nx]), by+dy) - lower_bound(all(ay[nx]), by-dy);
			}
		}
		cout << ans << endl;
	}


	return 0;
}