#include <bits/stdc++.h>
using namespace std;
struct timer {
  time_t start;
  timer() { start = clock(); }
  ~timer() {
    cerr << 1. * (clock() - start) / CLOCKS_PER_SEC << " secs" << endl;
  }
};
const double PI = acos(-1);
long long n, k;
double x[1010], y[1010], r[1010];
double dist(int a, int b) {
  return sqrt(((x[b] - x[a]) * (x[b] - x[a])) +
              ((y[b] - y[a]) * (y[b] - y[a])));
}
double angle(int a, int b) { return atan2(y[b] - y[a], x[b] - x[a]); }
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < (n); i++) cin >> x[i] >> y[i] >> r[i];
  long long ans = 0;
  for (int i = 0; i < (n); i++) {
    vector<pair<double, int> > v;
    for (int j = 0; j < (n); j++)
      if (j != i) {
        double d = dist(i, j);
        double t = angle(i, j);
        double a = asin((r[j] - r[i]) / d);
        double b = asin((r[j] + r[i]) / d);
        v.push_back(make_pair(t - a, 1));
        v.push_back(make_pair(t + b - 1e-9, -1));
        v.push_back(make_pair(t + PI - b, 1));
        v.push_back(make_pair(t + PI + a - 1e-9, -1));
      }
    int vs = ((int)(v).size());
    for (int i = 0; i < (vs); i++)
      v.push_back(make_pair(v[i].first + 2 * PI, v[i].second));
    sort(v.begin(), v.end());
    long long c = 0;
    for (int i = 0; i < (((int)(v).size())); i++) {
      ans = max(ans, c);
      c += v[i].second;
    }
  }
  cout << n + k * (k + 1) / 2 + ans * k;
}
