## Eyes of Void

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 512M

Author:
Problem type

In his second flashback, Bai Yuechu recall Tushan’s greatest enemy: the Queen of the Black Foxen. In one of their legendary fights with her, his ancestor, Dongfang Yuechu uses the "Tear void" ability.

The Queen of the Black Foxen can be modelled as a 2D plane (see picture), with the point that the tear void hits being (0, 0). The tear void then expands in a circle.

Her body has "magical points", represented as coordinates on the 2D plane. The i-th point, if hit by the tear void, deals damage to her. However, expanding the tear void also causes Dongfang Yuechu to expend energy. Specifically, a tear void with radius costs energy, where is a constant in the input. Dongfang wants to measure his effectiveness, which is defined as the (sum of ) , for all which are inside the circle. Help him calculate the maximum effectiveness he can have.

#### Input Specification

Line 1: ()

Next lines: 3 integers , representing a point with damage at . ().

#### Sample Input

10 3
36 5 0
30 -8 -2
61 -5 -4
74 -2 3
19 -7 -4
21 -5 -4
75 9 -5
29 10 -8
81 8 2
99 3 -7

#### Sample Output

217