#include <bits/stdc++.h>
using namespace std;
double x[1010];
double y[1010];
double r[1010];
pair<double, int> pp[100010];
int qq;
int main() {
  int n;
  long long k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%lf %lf %lf", &x[i], &y[i], &r[i]);
  long long t = 1;
  for (int i = 0; i < n; i++) {
    qq = 0;
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      double angle = atan2(y[j] - y[i], x[j] - x[i]);
      double d =
          sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
      double d1 = acos(-1.0) * 0.5 - asin((r[i] - r[j]) / d);
      double d2 = acos(-1.0) * 0.5 - asin((r[i] + r[j]) / d);
      double x1 = angle - d1;
      double x2 = angle - d2;
      double y1 = angle + d1;
      double y2 = angle + d2;
      pp[qq++] = make_pair(x1 + 1e-8, 1);
      pp[qq++] = make_pair(x2 - 1e-8, -1);
      pp[qq++] = make_pair(y2 + 1e-8, 1);
      pp[qq++] = make_pair(y1 - 1e-8, -1);
    }
    sort(pp, pp + qq);
    for (int j = 0; j < qq; j++) pp[j + qq] = pp[j];
    long long tmp = 0;
    for (int j = 0; j < qq + qq; j++) {
      tmp += pp[j].second;
      t = max(t, tmp + 1);
    }
  }
  long long ans = n;
  for (long long i = 0; i < k; i++) ans += t + i;
  cout << ans << endl;
  return 0;
}
