#include <bits/stdc++.h>
using namespace std;
const long long int N = 5e5 + 10;
long long int n, k, x[N], y[N];
double dist[N];
map<pair<long long int, long long int>, vector<long long int> > slope;
long long int gcd(long long int a, long long int b) {
  return a ? gcd(b % a, a) : b;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long int i = 0; i < (long long int)(n); i++) {
    cin >> x[i] >> y[i];
    dist[i] = hypot(x[i], y[i]);
    auto d = abs(gcd(abs(x[i]), abs(y[i])));
    if (d == 0) d = 1;
    pair<long long int, long long int> s(x[i] / d, y[i] / d);
    slope[s].push_back(i);
  }
  vector<double> evt;
  for (auto &kv : slope) {
    auto &v = kv.second;
    sort((v).begin(), (v).end(),
         [&](long long int i, long long int j) { return dist[i] < dist[j]; });
    long long int coef = k - 1;
    long long int l = 0, r = ((long long int)(v).size());
    double sum = 0;
    while (l < r) {
      if (coef > 0) {
        --r;
        evt.push_back(coef * dist[v[r]]);
        coef -= 2;
      } else {
        evt.push_back(coef * dist[v[l]] - 2 * sum);
        sum += dist[v[l]];
        l++;
      }
    }
  }
  sort((evt).begin(), (evt).end());
  reverse((evt).begin(), (evt).end());
  vector<double> good(evt.begin(), evt.begin() + k);
  sort((good).begin(), (good).end(),
       [](double x, double y) { return abs(x) < abs(y); });
  double total = 0;
  for (auto x : good) total += x;
  cout << fixed << setprecision(15) << total << endl;
  return 0;
}
