#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2005,INF=1<<30;

const double eps=1e-10;
const double pi=acos((long double)-1.0L);
#define equals(a,b) (fabs((a)-(b))<eps)

double torad(int deg) {return (double)(deg)*pi/180.0;}
double todeg(double ang) {return ang*180.0/pi;}

class Point{
public:
    double x,y,z;
    
    Point(double x=0,double y=0,double z=0):x(x),y(y),z(z){}
    
    Point operator + (Point p){return Point(x+p.x,y+p.y,z+p.z);}
    Point operator - (Point p){return Point(x-p.x,y-p.y,z-p.z);}
    Point operator * (double a){return Point(a*x,a*y,a*z);}
    Point operator / (double a){return Point(x/a,y/a,z/a);}
    
    double abs(){return sqrt(norm());}
    double norm(){return x*x+y*y+z*z;}
    
    bool operator < (const Point &p)const{
        return x+eps<p.x||(equals(x,p.x)&&y+eps<p.y)||(equals(x,p.x)&&equals(y,p.y)&&z+eps<p.z);
    }
    
    bool operator == (const Point &p)const{
        return fabs(x-p.x)<eps&&fabs(y-p.y)<eps&&fabs(z-p.z)<eps;
    }
};

typedef Point Vector;

double norm(Vector a){
    return a.x*a.x+a.y*a.y+a.z*a.z;
}

double abs(Vector a){
    return sqrt(norm(a));
}

double dot(Vector a,Vector b){
    return a.x*b.x+a.y*b.y+a.z*b.z;
}

Point cross(Vector a,Vector b){
    return Point{a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x};
}

struct Segment{
    Point p1,p2;
};

bool isOrthogonal(Vector a,Vector b){
    return equals(dot(a,b),0.0);
}

bool isOrthogonal(Point a1,Point a2,Point b1,Point b2){
    return isOrthogonal(a1-a2,b1-b2);
}

bool isOrthogonal(Segment s1,Segment s2){
    return equals(dot(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

Point project(Segment s,Point p){
    Vector base=s.p2-s.p1;
    double r=dot(p-s.p1,base)/norm(base);
    return s.p1+base*r;
}

Point reflect(Segment s,Point p){
    return p+(project(s,p)-p)*2.0;
}

static const int counter_clockwise=1;
static const int clockwise=-1;
static const int online_back=2;
static const int online_front=-2;
static const int on_segment=0;

typedef Segment Line;

double getDistance(Point a,Point b){
    return abs(a-b);
}

double getDistanceLP(Line l,Point p){
    Point q=project(l,p);
    return getDistance(p,q);
}

double getDistanceSP(Segment s,Point p){
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return abs(p-s.p1);
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return abs(p-s.p2);
    return getDistanceLP(s,p);
}

class Circle{
public:
    Point c;
    double r;
    Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

pair<Point,Point> segCrossPpoints(Circle c,Line l){
    //assert(intersect(c,l));
    Vector pr=project(l,c.c);
    Vector e=(l.p2-l.p1)/abs(l.p2-l.p1);
    double base=sqrt(c.r*c.r-norm(pr-c.c));
    return make_pair(pr+e*base,pr-e*base);
}

double arg(Vector p){return atan2(p.y,p.x);}
Vector polar(double a,double r){return Point(cos(r)*a,sin(r)*a);}

pair<Point,Point> getCrossPoints(Circle c1,Circle c2){
    //assert(intersect(c1,c2));
    double d=abs(c1.c-c2.c);
    double a=acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
    double t=arg(c2.c-c1.c);
    return make_pair(c1.c+polar(c1.r,t+a),c1.c+polar(c1.r,t-a));
}

typedef vector<Point> Polygon;

bool dp[1<<15][2005],need[15][2005];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M,R;cin>>N>>M>>R;
        if(N==0) break;
        
        for(int i=0;i<(1<<M);i++){
            for(int j=0;j<N;j++){
                if(i<M) need[i][j]=0;
                dp[i][j]=0;
            }
        }
        
        vector<Point> S(N),T(M);
        vector<double> A(N),B(M),damage(M);
        for(int i=0;i<N;i++) cin>>S[i].x>>S[i].y>>S[i].z>>A[i];
        for(int i=0;i<M;i++) cin>>T[i].x>>T[i].y>>T[i].z>>B[i];
        Point O;
        cin>>O.x>>O.y>>O.z;
        
        for(int i=0;i<M;i++){
            for(int j=0;j<N;j++){
                Segment s={T[i],O};
                double d=getDistanceSP(s,S[j]),d2=getDistance(S[j],T[i]),d3=getDistance(S[j],O);
                if(d<A[j]&&(d2>A[j]||d3>A[j])) need[i][j]=1;
            }
            damage[i]=B[i]/norm(T[i]-O);
        }
        
        double ans=0;
        
        for(int bit=1;bit<(1<<M);bit++){
            int f=0;
            for(int i=0;i<M;i++){
                if(bit&(1<<i)){
                    f=i;
                    break;
                }
            }
            int cnt=0;
            for(int j=0;j<N;j++){
                dp[bit][j]|=dp[bit^(1<<f)][j];
                dp[bit][j]|=need[f][j];
                if(dp[bit][j]) cnt++;
            }
            
            double sum=0.0;
            
            for(int i=0;i<M;i++) if(bit&(1<<i)) sum+=damage[i];
            
            if(cnt<=R) chmax(ans,sum);
        }
        
        cout<<setprecision(25)<<ans<<endl;
    }
}



Measured memory_bytes: 67496