#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
struct P {
  double x, y;
};
inline int sgn(double a) { return a > 1e-8 ? 1 : (a < -1e-8 ? -1 : 0); }
double dist(P p1, P p2) {
  return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
P p[1100];
double r[1100];
bool cmp(const pair<double, int> p1, const pair<double, int> p2) {
  if (sgn(p1.first - p2.first) == 0) return p1.second < p2.second;
  return p1.first < p2.first;
}
pair<double, int> rng[1100 * 10];
void fix(double &x) {
  while (x < -PI) x += 2 * PI;
  while (x >= PI) x -= 2 * PI;
}
int FruitNinja(P *p, double *r, int n) {
  if (n == 0) return 0;
  int ret = 1, cnt;
  for (int i = 0; i < n; i++) {
    cnt = 0;
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      double d = sqrt((p[i].x - p[j].x) * (p[i].x - p[j].x) +
                      (p[i].y - p[j].y) * (p[i].y - p[j].y));
      double x = atan2(p[j].y - p[i].y, p[j].x - p[i].x);
      double y = PI / 2.0 - asin((r[i] - r[j]) / d);
      double z = PI / 2.0 - asin((r[i] + r[j]) / d);
      double deg1, deg2;
      deg1 = x - y, deg2 = x - z;
      fix(deg1);
      fix(deg2);
      if (deg1 <= deg2) {
        rng[cnt++] = pair<double, int>(deg1 + 1e-8, 1);
        rng[cnt++] = pair<double, int>(deg2 - 1e-8, -1);
      } else {
        rng[cnt++] = pair<double, int>(deg1 + 1e-8, 1);
        rng[cnt++] = pair<double, int>(PI - 1e-8, -1);
        rng[cnt++] = pair<double, int>(-PI + 1e-8, 1);
        rng[cnt++] = pair<double, int>(deg2 - 1e-8, -1);
      }
      deg1 = x + z, deg2 = x + y;
      fix(deg1);
      fix(deg2);
      if (deg1 <= deg2) {
        rng[cnt++] = pair<double, int>(deg1 + 1e-8, 1);
        rng[cnt++] = pair<double, int>(deg2 - 1e-8, -1);
      } else {
        rng[cnt++] = pair<double, int>(deg1 + 1e-8, 1);
        rng[cnt++] = pair<double, int>(PI - 1e-8, -1);
        rng[cnt++] = pair<double, int>(-PI + 1e-8, 1);
        rng[cnt++] = pair<double, int>(deg2 - 1e-8, -1);
      }
    }
    sort(rng, rng + cnt, cmp);
    int tmp = 1;
    for (int i = 0; i < cnt; i++) {
      tmp += rng[i].second;
      ret = max(ret, tmp);
    }
  }
  return ret;
}
int main() {
  int n, k;
  while (scanf("%d %d", &n, &k) != EOF) {
    for (int i = 0; i < n; i++) scanf("%lf %lf %lf", &p[i].x, &p[i].y, r + i);
    int ma = FruitNinja(p, r, n);
    cout << (ma - 1) * (long long)(k + 1) + 1 + k * (long long)(k + 1) / 2 +
                (n - ma)
         << endl;
  }
}
