```#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define F first
#define S second
#define EPS (long double)1e-9
// r < 10^4
typedef long double ld;
ld d2(pair<ld, ld> p) {
return p.F*p.F+p.S*p.S;
}
ld det(ld a, ld b, ld c) {
return (b*b - 4.0*a*c);
}
struct ev {
ev(ld _t, int _s):t(_t),s(_s){};
ld t; int s; // time, side
};
bool comp(ev l, ev r) {
if(l.t == r.t) return l.s < r.s;
return l.t < r.t;
}

typedef pair<ld,ld> pld;
bool ok(int K, ld r2, vector<pld>& pos, vector<pld> & sp) {
//cerr << " ok " << r2 << endl;
long double min_t= -1, max_t = 0;
vector<ev> t_r;
for(int i=0;i<pos.size();++i) {
ld c = d2(pos[i]) - r2;
ld b = 2.0*(sp[i].F*pos[i].F+sp[i].S*pos[i].S);
ld a = d2(sp[i]);
ld d = det(a,b,c);
if (d<0) {
continue;
}
d = sqrt(d);

ld z1 = (-1.0*b - d)/2.0/a;
ld z2 = (-1.0*b + d)/2.0/a;

if(z2 < 0.0) {
continue;
}
t_r.push_back(ev(z1, 1)); // l
t_r.push_back(ev(z2, 0)); // h

//cerr << "add " << pos[i].F << ' ' <<pos[i].S << endl;
}
int k = 0, mk=0;
sort(t_r.begin(), t_r.end(), &comp);
//cerr << "t_r " << t_r.size() << endl;

for(int i=0;i<t_r.size(); ++i) {
if(t_r[i].s == 0) {
if(t_r[i].t >=0.0 && (i==t_r.size()-1) ||(t_r[i].t != t_r[i+1].t) || (t_r[i].s != t_r[i+1].s)) mk = max(k,mk);
k--;
}else{
k++;
}
}
//cerr << "mk " << mk << endl;
return mk >= K;
}

int main() {
int n,k, cx,cy;
while(cin>>cx>>cy>>n>>k) {
vector<pld> pos(n, pld(0,0));
vector<pld> sp(n, pld(0,0));

long double min_r=0, max_r = 0;

for(int i=0;i<n;++i) {
ld x,y,x_,y_;
cin>> pos[i].first >>pos[i].S >>x_>>y_;
sp[i].F = x_ - pos[i].F;
sp[i].S = y_ - pos[i].S;
pos[i].F -= cx;
pos[i].S -= cy;
max_r = max(max_r, d2(pos[i]));
}

while (abs(min_r - max_r) > EPS) {
ld mid = (min_r + max_r) / 2.0;
if(ok(k,mid, pos, sp)){
max_r = mid;
} else {
min_r = mid;
}
}
cout << fixed << setprecision(5) << sqrt(min_r) << endl;
}
return 0;

}
```