#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1), eps = 1e-12;
int n, K;
pair<double, int> g[8001];
struct ww {
  double first, second;
  double len() { return sqrt(first * first + second * second); }
  ww operator-(ww& A) { return {first - A.first, second - A.second}; }
} a[1001];
double r[1001];
auto calc = [](int i) {
  int m = 0, ma = 0;
  for (int _r = n, j = 1; j <= _r; ++j)
    if (i ^ j) {
      ww V = a[j] - a[i];
      double A = atan2(V.second, V.first),
             B = asin((r[j] - r[i]) / V.len()) + pi / 2,
             G = acos((r[j] + r[i]) / V.len());
      for (double S : {0., 2 * pi}) {
        g[++m] = pair<double, int>(A - B + S + eps, 1);
        g[++m] = pair<double, int>(A - G + S - eps, -1);
        g[++m] = pair<double, int>(A + G + S + eps, 1);
        g[++m] = pair<double, int>(A + B + S - eps, -1);
      }
    }
  sort(g + 1, g + m + 1);
  for (int j = 1, t = 0; j <= m; ++j)
    if ((t += g[j].second) > ma) ma = t;
  return ma;
};
int main() {
  scanf("%d%d", &n, &K);
  for (int _r = n, i = 1; i <= _r; ++i)
    scanf("%lf%lf%lf", &a[i].first, &a[i].second, r + i);
  printf("%I64d\n",
         []() {
           int ma = 0;
           for (int _r = n, i = 1; i <= _r; ++i) ma = max(ma, calc(i));
           return ma;
         }() * K +
             (K + 1ll) * K / 2 + n);
}
