405856: GYM102135 I Happy triangles

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Happy trianglestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There are non-degenerate obtuse triangles where shortest sides differ by no more than q times from each other. Let us call them happy triangles. Find the number of happy triangles that can be formed with angles at the indicated points for the given set of points.

Input

The first line contains two numbers n and q (1 ≤ n ≤ 1 000, 1 ≤ q ≤ 30 000) — the number of points and the factor for the sides comparison respectively. The factor q is given with exactly two decimal places.

Each of the following n rows contains two integers xi yi (|xi|, |yi| ≤ 104) — coordinates of the i-th point.

It is guaranteed that any two given points are distinct and that for any triple of different points A B C the condition |D(A, B) - D(A, C) * Q| > 10 - 6 is fulfilled. D(A, B) is Euclidean distance between points A and B.

Output

A single line contains the number of happy triangles.

ExamplesInput
6 2.01
0 2
2 4
-1 3
0 0
1 3
1 2
Output
6
Input
9 2.64
10 -7
0 -6
-1 8
9 -3
-1 10
-3 -1
9 9
-1 -5
4 -3
Output
42

加入题单

算法标签: