SV01 - Birthday Party !!

no tags 

Tatsu'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. Tongue out Nobita 's (Tatsu's younger brother) birthday is about to start in 7 minutes too, and while Tatsu is older, she decided to play the boss a little. She told Nobita to cut the cake by k straight-line cuts (the cutting lines can intersect) to divide banana circles into banana pieces.

Tatsu has many guests and she wants everyone to get at least one banana piece. That's why she told Nobita 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 Nobita will achieve.

Input

The first line contains two integers n and k — the number of banana circles and the number of cuts Nobita 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 z — the coordinates of the center of the corresponding banana piece and its radius ( - 1000 ≤ x, y ≤ 1000, 1 ≤ z ≤ 1000).

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

Output

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

Example

Input:
1 1
0 0 1

Output:
2
Input:
2 2
0 0 1
3 0 1

Output:
7

hide comments
darol: 2015-05-16 21:51:39

Sahil Thakur> two cuts intersects in 1st circle dividing it to 4 pieces and 2nd circle is divided in 3 pieces (as 2 lines go through it)

Sahil Thakur: 2015-05-15 21:19:25

How is the output of second test case 7?


Added by:SrGrace
Date:2015-05-14
Time limit:1s-4s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY