func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3fffffff;   const int SINF = 0x7fffffff;   const long long LINF = 0x3fffffffffffffff;   const long long SLINF = 0x7fffffffffffffff;   const long double DINF = pow(2, 100);   const int MAXN = 100007;   const long double EPS = 1e-17;   const long double AEPS = 1e-7;   const int TMS = 80;   const long double MAX = 4e9;   const long double PI = acos(-1.0);   class ftT {    public:     void clear() { memset(data, 0, sizeof(data)); }     void upd(int p, int x) {       for (; p < MAXN; p += p & -p) data[p] += x;     }     int sum(int p) {       int ans = 0;       for (; p; p ^= p & -p) ans += data[p];       return ans;     }     int query(int l, int r) { return sum(r) - sum(l - 1); }       private:     int data[MAXN];   } ft;   struct eT {     void setd(long double _t, long double _r, int _tp, int _id) {       t = _t, r = _r, tp = _tp, id = _id;     }     bool operator<(const eT &a) const {       return ((((t - a.t) >= 0) ? (t - a.t) : (-(t - a.t))) > EPS) ? t < a.t              : (tp ^ a.tp)                                         ? (tp > a.tp)                                                                    : (r < a.r);     }     long double t, r;     int tp, id;   } ev[MAXN];   int n, m;   int ke;   long double sx, sy;   long double la[MAXN], lb[MAXN];   long double al[MAXN], ar[MAXN];   int pl[MAXN], pr[MAXN];   void init();   void input();   void work();   void precheck(long double tst);   long long check(long double tst);   long double getsum(long double cr);   long double adj(long double ang);   long double getdist(int i, int j);   int main() {     init();     input();     work();   }   void init() { ios::sync_with_stdio(false); }   void input() {     scanf( %d , &n);     int tx, ty;     scanf( %d%d%d , &tx, &ty, &m), sx = static_cast<long double>(tx) / 1000,                                    sy = static_cast<long double>(ty) / 1000;     for (int i = 1; i <= n; ++i)       scanf( %d%d , &tx, &ty), la[i] = static_cast<long double>(tx) / 1000,                                lb[i] = static_cast<long double>(ty) / 1000;   }   void work() {     long double l = 0, r = MAX, mid;     for (int _t = 0; _t < TMS; ++_t) {       mid = l + (r - l) / 2;       if (check(mid) >= m)         r = mid;       else         l = mid;     }     long double maxd = l;     while (check(l) >= m) l -= (((1) > (l)) ? (1) : (l)) * AEPS;     int nc = check(l);     cout << setprecision(13) << fixed << (getsum(l) + maxd * (m - nc)) << endl;   }   void precheck(long double tst) {     long double sd, oa, da, a1, a2;     for (int i = 1; i <= n; ++i) {       sd = abs(la[i] * sx - sy + lb[i]) / sqrt(la[i] * la[i] + 1);       if (sd > tst - EPS)         al[i] = ar[i] = -DINF;       else {         if ((((la[i]) >= 0) ? (la[i]) : (-(la[i]))) < EPS)           oa = PI / 2;         else           oa = atan(-1 / la[i]);         if (oa < -EPS) oa += PI;         if (la[i] * sx + lb[i] - sy < -EPS) oa += PI;         da = acos(sd / tst);         a1 = adj(oa + da), a2 = adj(oa - da);         if (a1 > a2) swap(a1, a2);         al[i] = a1, ar[i] = a2;       }     }     ke = 0;     for (int i = 1; i <= n; ++i)       if (al[i] != -DINF)         ev[++ke].setd(al[i], ar[i], 1, i), ev[++ke].setd(ar[i], ar[i], 0, i);     sort(ev + 1, ev + 1 + ke);     for (int i = 1; i <= ke; ++i) {       if (ev[i].tp)         pl[ev[i].id] = i;       else         pr[ev[i].id] = i;     }   }   long long check(long double tst) {     precheck(tst);     long long ans = 0;     int ni;     ft.clear();     for (int i = 1; i <= ke; ++i) {       if (ev[i].tp) {         ni = ev[i].id;         ans += ft.query(pl[ni], pr[ni]);         ft.upd(pr[ni], 1);       }     }     return ans;   }   long double getsum(long double cr) {     precheck(cr);     long double ans = 0;     vector<pair<int, int> > ar;     int ni, li;     for (int i = 1; i <= ke; ++i) {       if (ev[i].tp) {         ni = ev[i].id;         li = lower_bound(ar.begin(), ar.end(), make_pair(i, 0)) - ar.begin();         for (int j = li; j < ar.size() && ar[j].first <= pr[ni]; ++j)           ans += getdist(ar[j].second, ni);         ar.insert(upper_bound(ar.begin(), ar.end(), make_pair(pr[ni], INF)),                   make_pair(pr[ni], ni));       }     }     return ans;   }   long double adj(long double ang) {     while (ang < -EPS) ang += 2 * PI;     while (ang > 2 * PI - EPS) ang -= 2 * PI;     return ang;   }   long double getdist(int i, int j) {     long double x = (lb[i] - lb[j]) / (la[j] - la[i]);     long double y = (la[j] * lb[i] - la[i] * lb[j]) / (la[j] - la[i]);     return sqrt((x - sx) * (x - sx) + (y - sy) * (y - sy));   }   