#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
};
double angle(point P, point Q) {
  double dx = Q.x - P.x, dy = Q.y - P.y;
  return atan2(dy, dx);
}
double normalize(double theta) {
  while (theta < -acos(-1.0)) theta += 2.0 * acos(-1.0);
  while (theta > acos(-1.0)) theta -= 2.0 * acos(-1.0);
  return theta;
}
double dist(point P, point Q) {
  double dx = P.x - Q.x, dy = P.y - Q.y;
  return sqrt(dx * dx + dy * dy);
}
int N;
point O[1010];
double r[1010];
int func(void) {
  int ans = 1, i, j, k;
  for ((i) = 0; (i) < (int)(N); (i)++) {
    int tmp = 1;
    vector<pair<double, int> > v;
    for ((j) = 0; (j) < (int)(N); (j)++)
      if (j != i) {
        double mid = angle(O[i], O[j]);
        double d = dist(O[i], O[j]);
        {
          double low = mid - asin((r[j] - r[i]) / d);
          double high = mid - asin((-r[j] - r[i]) / d) - 1.0E-9;
          low = normalize(low);
          high = normalize(high);
          v.push_back(make_pair(low, 1));
          v.push_back(make_pair(high, -1));
          if (low > high) tmp++;
        }
        {
          double low = mid + acos(-1.0) - asin((r[j] + r[i]) / d) + 1.0E-9;
          double high = mid + acos(-1.0) - asin((-r[j] + r[i]) / d);
          low = normalize(low);
          high = normalize(high);
          v.push_back(make_pair(low, 1));
          v.push_back(make_pair(high, -1));
          if (low > high) tmp++;
        }
      }
    sort(v.begin(), v.end());
    for ((j) = 0; (j) < (int)(v.size()); (j)++) {
      ans = max(ans, tmp);
      tmp += v[j].second;
    }
  }
  return ans;
}
int main(void) {
  int i;
  long long K;
  cin >> N >> K;
  for ((i) = 0; (i) < (int)(N); (i)++) cin >> O[i].x >> O[i].y >> r[i];
  long long cnt = func();
  long long ans = N + cnt * K + K * (K - 1) / 2;
  cout << ans << endl;
  return 0;
}
