#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
#include <set>

struct Vector {
	int dx, dy, dz;
	struct Angle angle(Vector that) const;
	double length()const;
	int norm() const;
};
struct Coordinate {
	int x, y, z;
	double distance(Coordinate that) const;
	Vector operator-(Coordinate that) const {
		return Vector{ x - that.x, y - that.y, z - that.z };
	}
};
struct Angle {
	double sin, cos;
	static Angle from_cos(double cos);
};
struct Balloon {
	Coordinate center;
	int radius;
};
struct Light {
	Coordinate center;
	double strength;
	bool is_intercepted(Coordinate origin, Balloon balloon) const;
	double brightness(Coordinate origin) const;
};
int power(int base, int exp) {
	switch (exp) {
	case 0: return 1;
	case 1: return base;
	default: return power(base, exp & 1) * power(base * base, exp >> 1);
	}
}
int main() {
	std::vector<bool> is_searching(power(2, 15), false);
	while (true) {
		int n, m, r; std::cin >> n >> m >> r; if (n == 0 && m == 0) break;
		std::vector<Balloon> balloons(n);
		std::vector<Light> lights(m);
		Coordinate origin;
		for (auto& b : balloons) std::cin >> b.center.x >> b.center.y >> b.center.z >> b.radius;
		for (auto& l : lights) std::cin >> l.center.x >> l.center.y >> l.center.z >> l.strength;
		std::cin >> origin.x >> origin.y >> origin.z;
		std::vector<int> pattern; pattern.reserve(n);
		for (const auto b : balloons) {
			int pat = 0;
			for (auto i = 0; i < m; ++i) {
				if (lights[i].is_intercepted(origin, b)) {
					pat += 1 << i;
				}
			}
			pattern.push_back(pat);
		}
		std::fill(is_searching.begin(), std::next(is_searching.begin(), power(2, m)), false);
		std::queue<int> queue; queue.push(power(2, m) - 1);
		is_searching[power(2, m) - 1] = true;
		double max_score = 0;
		while (!queue.empty()) {
			const auto top = queue.front(); queue.pop();
			int removable = r;
			for (const auto p : pattern) {
				if ((p & top) != 0) {
					if (--removable < 0) break;
				}
			}
			if (removable >= 0) {
				double score = 0;
				for (auto i = 0; i < m; ++i) if ((top & (1 << i)) != 0) {
					score += lights[i].brightness(origin);
				}
				max_score = std::max(max_score, score);
			}
			else {
				for (auto i = 0; i < m; ++i) if ((top & (1 << i)) != 0 && !is_searching[top - (1 << i)]) {
					is_searching[top - (1 << i)] = true;
					queue.push(top - (1 << i));
				}
			}
		}
		std::cout << std::setprecision(10) << std::fixed << max_score << '\n';
	}
}

bool Light::is_intercepted(Coordinate origin, Balloon balloon) const
{
	if (balloon.center.distance(origin) <= balloon.radius &&
		balloon.center.distance(center) <= balloon.radius) return false;
	if (balloon.center.distance(origin) <= balloon.radius ||
		balloon.center.distance(center) <= balloon.radius) return true;

	const auto angle = (origin - center).angle(balloon.center - center);
	return angle.cos >= 0 && balloon.center.distance(center) * angle.cos <= origin.distance(center) && angle.sin * balloon.center.distance(center) <= balloon.radius;
}

double Light::brightness(Coordinate origin) const
{
	return strength / (center - origin).norm();
}

Angle Angle::from_cos(double cos)
{
	return Angle{ std::sqrt(1 - cos * cos), cos };
}

double Coordinate::distance(Coordinate that) const
{
	return (*this - that).length();
}

Angle Vector::angle(Vector that) const
{
	return Angle::from_cos((dx * that.dx + dy * that.dy + dz * that.dz) / std::sqrt(norm() * that.norm()));
}

double Vector::length() const
{
	return std::sqrt(norm());
}

int Vector::norm() const
{
	return dx * dx + dy * dy + dz * dz;
}



Measured memory_bytes: 3288