// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU

signed main(){
	int n,m,r;
	while(cin>>n>>m>>r,n|m|r){
		vvd S(n,vd(4));
		rep(i,n)rep(j,4)cin>>S[i][j];
		vvd T(m,vd(4));
		rep(i,m)rep(j,4)cin>>T[i][j];
		double E[3];
		rep(i,3)cin>>E[i];
		
		vector<bitset<2020> >dp(m);
		rep(i,m)rep(j,n){
			double dis1=hypot(T[i][0]-S[j][0],hypot(T[i][1]-S[j][1],T[i][2]-S[j][2]));
			double dis2=hypot(S[j][0]-E[0],hypot(S[j][1]-E[1],S[j][2]-E[2]));
			double dis=S[j][3];
			if(dis1<dis&&dis2<dis);
			else if(dis1<dis&&dis2>dis||dis1>dis&&dis2<dis)dp[i][j]=1;
			else{
				double dis3=hypot(T[i][0]-E[0],hypot(T[i][1]-E[1],T[i][2]-E[2]));
				if(abs(dis1+dis2-dis3)<EPS){
					dp[i][j]=1;
					continue;
				}
				if(abs(dis1+dis3-dis2)<EPS)continue;
				if(abs(dis3+dis2-dis1)<EPS)continue;
				double ang=acos((dis1*dis1+dis3*dis3-dis2*dis2)/(2.*dis1*dis3));
				if(ang>PI/2)continue;
				ang=acos((dis2*dis2+dis3*dis3-dis1*dis1)/(2.*dis2*dis3));
				if(ang>PI/2)continue;
				double dis4=dis2*cos(ang);
				dis4=dis2*sin(ang);
				if(dis4<dis)dp[i][j]=1;
			}
		}
		// rep(i,m){show1d(dp[i]);cout<<endl;}
		double out=0;
		loop(i,1,1<<m){
			vi h(n);
			bitset<2020>bs;
			rep(j,m)if(i&1<<j)bs|=dp[j];
			int co=bs.count();
			if(co>r)continue;
			double sum=0;
			rep(j,m)if(i&1<<j)sum+=T[j][3]/(pow(T[j][0]-E[0],2)+pow(T[j][1]-E[1],2)+pow(T[j][2]-E[2],2));
			cmax(out,sum);
		}
		
		cout<<shosu(9)<<out<<endl;
	}
}









