The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

geometry

math

*2900

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Birthday

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputAnna'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* ≤ 10^{5}). 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

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/05/2024 03:50:03 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|