#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = acos((long double)0) * 2;
const int MAXN = 1100;
struct pt {
  long double x, y;
  pt() {}
  pt(long double x, long double y) : x(x), y(y) {}
  pt operator-(const pt& p) const { return pt(x - p.x, y - p.y); }
};
struct line {
  long double a, b, c;
  void norm() {
    long double z = sqrt(a * a + b * b);
    a /= z, b /= z, c /= z;
    if (c > EPS) {
      a = -a;
      b = -b;
      c = -c;
    }
  }
};
int n, k;
pt p[MAXN];
long double r[MAXN];
bool read() {
  if (!(cin >> n >> k)) return false;
  for (int i = 0; i < int(n); ++i) {
    int x, y, rr;
    scanf("%d%d%d", &x, &y, &rr);
    p[i].x = x;
    p[i].y = y;
    r[i] = rr;
  }
  return true;
}
inline long double sqr(long double a) { return a * a; }
inline long double norm(long double a) {
  while (a < -PI) a += 2 * PI;
  while (a > PI) a -= 2 * PI;
  return a;
}
inline void tangents(pt c, long double r1, long double r2, vector<line>& ans) {
  long double r = r2 - r1;
  long double z = sqr(c.x) + sqr(c.y);
  long double d = z - sqr(r);
  if (d < -EPS) return;
  d = sqrt(abs(d));
  line l;
  l.a = (c.x * r + c.y * d) / z;
  l.b = (c.y * r - c.x * d) / z;
  l.c = r1;
  l.norm();
  ans.push_back(l);
}
vector<line> tangents(pt a, long double ar, pt b, long double br) {
  vector<line> ans;
  for (int i = -1; i <= 1; i += 2)
    for (int j = -1; j <= 1; j += 2) tangents(b - a, ar * i, br * j, ans);
  return ans;
}
struct event {
  long double ang;
  int bal;
  event() {}
  event(long double ang, int bal) : ang(ang), bal(bal) {}
  bool operator<(const event& e) const {
    if (abs(ang - e.ang) > EPS) return ang < e.ang;
    return bal < e.bal;
  }
};
vector<event> e;
inline void add_events(int i, line l1, line l2) {
  long double ang1 = atan2(l1.b, l1.a), ang2 = atan2(l2.b, l2.a);
  if (ang2 < ang1)
    if (ang1 - ang2 > PI)
      ang2 += 2 * PI;
    else
      swap(ang1, ang2);
  if (ang2 <= ang1 + EPS) throw;
  for (int i = -2; i <= 2; ++i) {
    long double l = ang1 + 2 * PI * i, r = ang2 + 2 * PI * i;
    e.push_back(event(l, +1));
    e.push_back(event(r, -1));
  }
}
int solve_events() {
  sort(e.begin(), e.end());
  int ans = 0, bal = 0;
  for (int i = 0; i < int(e.size()); ++i) {
    long double ang = e[i].ang;
    while (i < (int)e.size() && abs(ang - e[i].ang) < EPS) {
      bal += e[i++].bal;
      if (bal < 0 || bal >= n) throw;
    }
    --i;
    ans = max(ans, bal);
  }
  return ans + 1;
}
long long formula(long long k, long long cnt) {
  if (!cnt) return 0;
  return (1 + k * (k + 1) / 2) + (cnt - 1) * (k + 1) + (n - cnt);
}
void solve() {
  long long ans = 0;
  for (int i = 0; i < int(n); ++i) {
    e.clear();
    for (int j = 0; j < int(n); ++j)
      if (i != j) {
        vector<line> l = tangents(p[i], r[i], p[j], r[j]);
        add_events(i, l[0], l[1]);
        add_events(i, l[2], l[3]);
      }
    int cnt = solve_events();
    ans = max(ans, formula(k, cnt));
  }
  cout << ans << endl;
}
int main() {
  if (!read()) throw;
  solve();
}

### Prompt

Your task is to create a CPP solution to the following problem:

Anna's got a birthday today. She invited many guests and cooked a huge (nearly infinite) birthday cake decorated by n banana circles of different sizes. Maria's birthday is about to start in 7 minutes too, and while Anna is older, she decided to play the boss a little. She told Maria to cut the cake by k straight-line cuts (the cutting lines can intersect) to divide banana circles into banana pieces. 

Anna has many guests and she wants everyone to get at least one banana piece. That's why she told Maria to make the total number of banana pieces maximum. It's not a problem if some banana pieces end up on the same cake piece — the key is to make the maximum number of banana pieces. Determine what result Maria will achieve.

Input

The first line contains two integers n and k — the number of banana circles and the number of cuts Maria should perform (1 ≤ n ≤ 1000, 1 ≤ k ≤ 105). Next n lines contain the positions and sizes of the banana circles (all banana circles are round). On the cake the Cartesian coordinate system is defined. Each line contains three integers x, y and r — the coordinates of the center of the corresponding banana piece and its radius ( - 1000 ≤ x, y ≤ 1000, 1 ≤ r ≤ 1000).

It is guaranteed that the banana circles do not intersect, do not touch each other and do not overlap with each other.

Pretest 10 is big test with n = k = 1000.

Output

Print the only integer — the largest number of banana pieces that Maria can get after she performs the k straight-line cuts.

Please do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

1 1
0 0 1


Output

2


Input

3 1
0 0 1
3 0 1
6 0 1


Output

6


Input

1 3
0 0 1


Output

7

### Response

```cpp
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = acos((long double)0) * 2;
const int MAXN = 1100;
struct pt {
  long double x, y;
  pt() {}
  pt(long double x, long double y) : x(x), y(y) {}
  pt operator-(const pt& p) const { return pt(x - p.x, y - p.y); }
};
struct line {
  long double a, b, c;
  void norm() {
    long double z = sqrt(a * a + b * b);
    a /= z, b /= z, c /= z;
    if (c > EPS) {
      a = -a;
      b = -b;
      c = -c;
    }
  }
};
int n, k;
pt p[MAXN];
long double r[MAXN];
bool read() {
  if (!(cin >> n >> k)) return false;
  for (int i = 0; i < int(n); ++i) {
    int x, y, rr;
    scanf("%d%d%d", &x, &y, &rr);
    p[i].x = x;
    p[i].y = y;
    r[i] = rr;
  }
  return true;
}
inline long double sqr(long double a) { return a * a; }
inline long double norm(long double a) {
  while (a < -PI) a += 2 * PI;
  while (a > PI) a -= 2 * PI;
  return a;
}
inline void tangents(pt c, long double r1, long double r2, vector<line>& ans) {
  long double r = r2 - r1;
  long double z = sqr(c.x) + sqr(c.y);
  long double d = z - sqr(r);
  if (d < -EPS) return;
  d = sqrt(abs(d));
  line l;
  l.a = (c.x * r + c.y * d) / z;
  l.b = (c.y * r - c.x * d) / z;
  l.c = r1;
  l.norm();
  ans.push_back(l);
}
vector<line> tangents(pt a, long double ar, pt b, long double br) {
  vector<line> ans;
  for (int i = -1; i <= 1; i += 2)
    for (int j = -1; j <= 1; j += 2) tangents(b - a, ar * i, br * j, ans);
  return ans;
}
struct event {
  long double ang;
  int bal;
  event() {}
  event(long double ang, int bal) : ang(ang), bal(bal) {}
  bool operator<(const event& e) const {
    if (abs(ang - e.ang) > EPS) return ang < e.ang;
    return bal < e.bal;
  }
};
vector<event> e;
inline void add_events(int i, line l1, line l2) {
  long double ang1 = atan2(l1.b, l1.a), ang2 = atan2(l2.b, l2.a);
  if (ang2 < ang1)
    if (ang1 - ang2 > PI)
      ang2 += 2 * PI;
    else
      swap(ang1, ang2);
  if (ang2 <= ang1 + EPS) throw;
  for (int i = -2; i <= 2; ++i) {
    long double l = ang1 + 2 * PI * i, r = ang2 + 2 * PI * i;
    e.push_back(event(l, +1));
    e.push_back(event(r, -1));
  }
}
int solve_events() {
  sort(e.begin(), e.end());
  int ans = 0, bal = 0;
  for (int i = 0; i < int(e.size()); ++i) {
    long double ang = e[i].ang;
    while (i < (int)e.size() && abs(ang - e[i].ang) < EPS) {
      bal += e[i++].bal;
      if (bal < 0 || bal >= n) throw;
    }
    --i;
    ans = max(ans, bal);
  }
  return ans + 1;
}
long long formula(long long k, long long cnt) {
  if (!cnt) return 0;
  return (1 + k * (k + 1) / 2) + (cnt - 1) * (k + 1) + (n - cnt);
}
void solve() {
  long long ans = 0;
  for (int i = 0; i < int(n); ++i) {
    e.clear();
    for (int j = 0; j < int(n); ++j)
      if (i != j) {
        vector<line> l = tangents(p[i], r[i], p[j], r[j]);
        add_events(i, l[0], l[1]);
        add_events(i, l[2], l[3]);
      }
    int cnt = solve_events();
    ans = max(ans, formula(k, cnt));
  }
  cout << ans << endl;
}
int main() {
  if (!read()) throw;
  solve();
}

```