#include <bits/stdc++.h>
using namespace std;

#define double long double
#define int ll
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using i128 = __int128_t;
#define rep(i,a,b) for (int i = a; i < (b); ++i)
#define sz(v) (int)(v).size()
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



template <class T> int sgn(T x) { return (x > 0) - (x < 0); }
template<class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
	friend ostream& operator<<(ostream& os, P p) {
		return os << "(" << p.x << "," << p.y << ")"; }
    friend istream& operator>>(istream& is, P& p) {
        double x, y; cin >> x >> y; // let's do this the slow way for now
        p.x = (double) x;
        p.y = (double) y;
        return is;
    }
};

typedef Point<double> P;
double segDist(P& s, P& e, P& p) {
	if (s==e) return (p-s).dist();
	auto d = (e-s).dist2(), t = min(d,max((double).0,(p-s).dot(e-s)));
	return ((p-s)*d-(e-s)*t).dist()/d;
}

template<class P>
vector<pair<P, P>> tangents(P c1, double r1, P c2, double r2) {
	P d = c2 - c1;
	double dr = r1 - r2, d2 = d.dist2(), h2 = d2 - dr * dr;
	if (d2 == 0 || h2 < 0)  return {};
	vector<pair<P, P>> out;
	for (double sign : {-1, 1}) {
		P v = (d * dr + d.perp() * sqrt(h2) * sign) / d2;
		out.push_back({c1 + v * r1, c2 + v * r2});
	}
	if (h2 == 0) out.pop_back();
	return out;
}

const double PI = acos(-1.);
const double EPS = 1e-6;

double angle_dist(double a, double b) {
    while (b < a) b += 2. * PI;
    return b - a;
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);

    int N, M; cin >> N >> M;
    P c; double R; cin >> c >> R;
    vector<P> A(N), B(M);
    rep(i,0,N) cin >> A[i];
    rep(i,0,M) cin >> B[i];

    struct Event {
        double ang;
        int type; // 1, 2, -1, -2 is A open, B open, A close, B close, respectively
        bool operator<(const Event& o) const { return ang < o.ang; } // sort counterclockwise
    };
    vector<Event> events;
    auto get_angles = [&](const P& p) -> pair<double,double> {
        auto tans = tangents(c, R, p, 0);
        assert(sz(tans) == 2);
        assert(fabs((tans[0].S - p).dist()) < EPS);
        assert(fabs((tans[1].S - p).dist()) < EPS);
        double ang0 = (tans[0].F - c).angle();
        double ang1 = (tans[1].F - c).angle();
        if (angle_dist(ang0, ang1) >= PI) swap(ang0, ang1);
        assert(angle_dist(ang0, ang1) < PI);
        return {ang0, ang1};
    };
    int A_count = 0, B_count = 0;
    rep(i,0,N) {
        auto [ang0, ang1] = get_angles(A[i]);
        events.push_back({ang0, 1});
        events.push_back({ang1, -1});
        if (ang0 > ang1) ++A_count;
    }
    rep(i,0,M) {
        auto [ang0, ang1] = get_angles(B[i]);
        events.push_back({ang0, 2});
        events.push_back({ang1, -2});
        if (ang0 > ang1) ++B_count;
    }
    sort(all(events));

    int ans = 0;
    for (const auto& [ang, type] : events) {
        if (type == 1) {
            ++A_count;
            ans += B_count;
        } else if (type == 2) {
            ++B_count;
            ans += A_count;
        } else if (type == -1) {
            --A_count;
        } else if (type == -2) {
            --B_count;
        } else assert(false);
    }
    cout << ans << '\n';

}
