#include <bits/stdc++.h>
using namespace std;
const int MAX = 1010;
const long double pi = 2 * acos(0.0);
int n, k, x[MAX], y[MAX], r[MAX];
int calc(vector<pair<long double, long double> > t) {
  vector<pair<long double, int> > s;
  for (int i = 0; i < t.size(); i++) {
    s.push_back(pair<long double, int>(t[i].first + 1e-6, 1));
    s.push_back(pair<long double, int>(t[i].second, -1));
  }
  int cur = 0, ans = 0;
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); i++) {
    cur += s[i].second;
    ans = max(ans, cur);
  }
  return ans;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d %d %d", &x[i], &y[i], &r[i]);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    vector<pair<long double, long double> > t;
    for (int j = 0; j < n; j++)
      if (i != j) {
        long double angle = atan2(y[j] - y[i], x[j] - x[i]);
        long double dist = hypot(x[i] - x[j], y[i] - y[j]);
        long double alfa = acos((r[i] - r[j]) / dist);
        long double a = dist * r[i] / (r[i] + r[j]);
        long double beta = acos(r[i] / a);
        t.push_back(pair<long double, long double>(angle - alfa, angle - beta));
        t.push_back(pair<long double, long double>(angle + beta, angle + alfa));
        t.push_back(pair<long double, long double>(2 * pi + angle - alfa,
                                                   2 * pi + angle - beta));
        t.push_back(pair<long double, long double>(2 * pi + angle + beta,
                                                   2 * pi + angle + alfa));
      }
    int cur = calc(t);
    ans = max(ans, n + (long long)k * (cur + cur + k + 1) / 2);
  }
  cout << ans << endl;
}
