#arc102a. [arc102_a]Triangular Relationship

[arc102_a]Triangular Relationship

Problem Statement

You are given integers NN and KK. Find the number of triples (a,b,c)(a,b,c) of positive integers not greater than NN such that a+b,b+ca+b,b+c and c+ac+a are all multiples of KK. The order of a,b,ca,b,c does matter, and some of them can be the same.

Constraints

  • 1leqN,Kleq2times1051 \\leq N,K \\leq 2\\times 10^5
  • NN and KK are integers.

Input

Input is given from Standard Input in the following format:

NN KK

Output

Print the number of triples (a,b,c)(a,b,c) of positive integers not greater than NN such that a+b,b+ca+b,b+c and c+ac+a are all multiples of KK.


Sample Input 1

3 2

Sample Output 1

(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1)(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3)(3,3,3) satisfy the condition.


Sample Input 2

5 3

Sample Output 2


Sample Input 3

31415 9265

Sample Output 3

27

Sample Input 4

35897 932

Sample Output 4

114191