Under construction

Still being built. Things may change

Huh? Can't hear you

Interview

Time limit2sMemory limit1024 MB

Summary
Count the unordered pairs of given points whose connecting line has slope K.
Level

Easy3 of 10

Topics
Hash map, Math
Solved
No attempts yet

Problem

Hyunbin and Sooyeon live on a two-dimensional coordinate plane. Both use old phones, so their calls often drop. While moving around and talking, they found that the call does not drop when the slope of the line connecting their positions is KK.

Given NN coordinates where Hyunbin and Sooyeon may live, count the number of ways to place them so that the call does not drop.

Input

The first line contains NN and KK, separated by a space. (2≤N≤2000002 \le N \le 200000, −109≤K≤109-10^9 \le K \le 10^9)

The next NN lines contain the xx and yy coordinates of point ii, separated by a space. (−109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9)

No coordinate is given more than once, and all values in the input are integers.

Output

Print the number of ways to place Hyunbin and Sooyeon so that the call does not drop.

Examples1

  1. Example 1

    Input
    8 1
    -1 -1
    2 3
    3 4
    0 0
    5 5
    3 1
    -7 -9
    6 6
    
    Expected output
    16