#include <iostream>
#include <iomanip>
#include <vector>
#include <bitset>
#include <cmath>

using namespace std;
static const double EPS = 1e-8;

inline int sign(double x){ return abs(x) < EPS ? 0 : (x > 0 ? 1 : -1); }

struct Point3D {
	double x, y, z;
	Point3D() : x(0), y(0), z(0) { }
	Point3D(double x, double y, double z) : x(x), y(y), z(z) { }

	Point3D operator-() const { return Point3D(-x, -y, -z); }
	Point3D operator+(const Point3D &p) const {
		return Point3D(x + p.x, y + p.y, z + p.z);
	}
	Point3D operator-(const Point3D &p) const {
		return Point3D(x - p.x, y - p.y, z - p.z);
	}
	Point3D operator*(const double s) const {
		return Point3D(x * s, y * s, z * s);
	}
	Point3D operator/(const double s) const {
		return Point3D(x / s, y / s, z / s);
	}
};

struct Line3D {
	Point3D a, b;
	Line3D() : a(), b() { }
	Line3D(const Point3D &a, const Point3D &b) : a(a), b(b) { }
};

struct Sphere {
	Point3D c;
	double r;
	Sphere() : c(), r(0) { }
	Sphere(const Point3D &c, double r) : c(c), r(r) { }
};

inline double dot(const Point3D &a, const Point3D &b){
	return a.x * b.x + a.y * b.y + a.z * b.z;
}
inline Point3D cross(const Point3D &a, const Point3D &b){
	return Point3D(
		a.y * b.z - a.z * b.y,
		a.z * b.x - a.x * b.z,
		a.x * b.y - a.y * b.x);
}
inline double norm(const Point3D &p){
	return p.x * p.x + p.y * p.y + p.z * p.z;
}
inline double abs(const Point3D &p){
	return sqrt(norm(p));
}
inline Point3D unit(const Point3D &p){
	return p / abs(p);
}
inline Point3D vec(const Line3D &l){
	return l.b - l.a;
}

inline Point3D projection(const Line3D &l, const Point3D &p){
	const Point3D v = vec(l);
	return l.a + v * (dot(p - l.a, v) / norm(v));
}
inline Point3D refrect(const Line3D &l, const Point3D &p){
	const Point3D q = projection(l, p);
	return p + (q - p) * 2.0;
}

inline bool intersectLP(const Line3D &l, const Point3D &p){
	return !sign(norm(cross(p - l.a, vec(l))));
}
inline bool intersectSP(const Line3D &l, const Point3D &p){
	const Point3D a = p - l.a, b = vec(l);
	if(norm(a) < EPS || norm(a - b) < EPS){ return true; }
	if(norm(cross(a, b)) > EPS){ return false; }
	if(a.x * b.x < -EPS){ return false; }
	if(a.y * b.y < -EPS){ return false; }
	if(a.z * b.z < -EPS){ return false; }
	return norm(a) < norm(b);
}
inline double distanceLP(const Line3D &l, const Point3D &p){
	const Point3D q = projection(l, p);
	return abs(p - q);
}
inline double distanceSP(const Line3D &l, const Point3D &p){
	const Point3D u = p - l.a;
	const Point3D v = projection(Line3D(Point3D(), vec(l)), u);
	if(intersectSP(Line3D(Point3D(), vec(l)), v)){ return abs(u - v); }
	return sqrt(min(norm(p - l.a), norm(p - l.b)));
}

vector<Point3D> crosspointCL(const Sphere &s, const Line3D &l){
	const Point3D &p = projection(l, s.c);
	const double d2 = norm(s.c - p);
	if(d2 > s.r * s.r + EPS){ return vector<Point3D>(); }
	if(d2 > s.r * s.r - EPS){ return vector<Point3D>(1, p); }
	const double sc = sqrt(s.r * s.r - d2);
	vector<Point3D> ret;
	ret.push_back(p + unit(vec(l)) * sc);
	ret.push_back(p - unit(vec(l)) * sc);
	return ret;
}
vector<Point3D> crosspointCS(const Sphere &s, const Line3D &l){
	const vector<Point3D> ps = crosspointCL(s, l);
	vector<Point3D> ret;
	for(int i = 0; i < ps.size(); ++i){
		if(intersectSP(l, ps[i])){ ret.push_back(ps[i]); }
	}
	return ret;
}

bool intersectCL(const Sphere &s, const Line3D &l){
	return distanceLP(l, s.c) < s.r + EPS;
}
bool intersectCS(const Sphere &s, const Line3D &l){
	return !crosspointCS(s, l).empty();
}

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(10);
	while(true){
		int n, m, r;
		cin >> n >> m >> r;
		if(n == 0 && m == 0 && r == 0){ break; }
		vector<Sphere> balloons(n);
		for(int i = 0; i < n; ++i){
			double x, y, z, r;
			cin >> x >> y >> z >> r;
			balloons[i] = Sphere(Point3D(x, y, z), r);
		}
		vector<Point3D> lights(m);
		vector<int> intensities(m);
		for(int i = 0; i < m; ++i){
			int x, y, z, intensity;
			cin >> x >> y >> z >> intensity;
			lights[i] = Point3D(x, y, z);
			intensities[i] = intensity;
		}
		Point3D objective;
		cin >> objective.x >> objective.y >> objective.z;
		vector< bitset<2048> > collisions(m);
		for(int i = 0; i < m; ++i){
			const Line3D s(objective, lights[i]);
			for(int j = 0; j < n; ++j){
				collisions[i][j] = intersectCS(balloons[j], s);
			}
		}
		double answer = 0.0;
		for(int i = 0; i < (1 << m); ++i){
			bitset<2048> collision;
			for(int j = 0; j < m; ++j){
				if(i & (1 << j)){ collision |= collisions[j]; }
			}
			if(collision.count() > r){ continue; }
			double sum = 0.0;
			for(int j = 0; j < m; ++j){
				if(i & (1 << j)){
					sum += intensities[j] / norm(lights[j] - objective);
				}
			}
			answer = max(answer, sum);
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 1372