#include <bits/stdc++.h>
using namespace std;
int fastio() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin.tie(nullptr);
  return 0;
}
int __fastio = fastio();
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p);
template <typename A>
ostream &operator<<(ostream &os, const set<A> &m) {
  os << "{";
  string sep = "";
  for (auto e : m) os << sep << e, sep = ", ";
  return os << "}";
}
template <typename A>
ostream &operator<<(ostream &os, const multiset<A> &m) {
  os << "{";
  string sep = "";
  for (auto e : m) os << sep << e, sep = ", ";
  return os << "}";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &m) {
  os << "{";
  string sep = "";
  for (auto e : m) os << sep << e.first << ": " << e.second, sep = ", ";
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  string sep = "";
  for (auto e : v) os << sep << e, sep = ", ";
  return os << "]";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
const int inf = 1000 << 20;
int _gcd(int a, int b) {
  if (a == 0) return b;
  return _gcd(b % a, a);
}
int main() {
  int n, k;
  cin >> n >> k;
  auto ang = [&](int x, int y) -> pair<int, int> {
    int g = abs(_gcd(x, y));
    if (g) {
      x /= g;
      y /= g;
    }
    return pair<int, int>(x, y);
  };
  map<pair<int, int>, int> mp;
  vector<vector<double>> lines;
  for (int i = 0; i < n; ++i) {
    long long x, y;
    cin >> x >> y;
    pair<int, int> p = ang(x, y);
    double val = sqrt(x * x + y * y);
    if (!mp.count(p)) {
      mp[p] = (int((lines).size()));
      lines.push_back(vector<double>());
    }
    lines[mp[p]].push_back(val);
  };
  vector<double> vals;
  for (auto &v : lines) {
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int neg = min((int((v).size())), (k + 1) / 2);
    for (int i = 0; i < neg; ++i) {
      vals.push_back(v[i] * (k - 1 - 2 * i));
    }
    double sm = 0;
    for (int i = (int((v).size())) - 1; i >= neg; --i) {
      vals.push_back(v[i] * (k - 1 - 2 * neg) - 2 * sm);
      sm += v[i];
    }
  };
  sort(vals.begin(), vals.end());
  reverse(vals.begin(), vals.end());
  ;
  double ans = 0;
  for (int i = 0; i < k; ++i) {
    ans += vals[i];
  }
  cout << ans << "\n";
}
