n,k = list(map(int,input().split()))

num = [0] * k

ans = 0

for i in range(1,n + 1):

  num[i%k] += 1

for a in range(k):

  b = (k - a) % k

  c = (k - a) % k

  if (b + c) % k != 0:

    continue

  ans += num[a] * num[b] * num[c]

print(ans)
n,k = list(map(int,input().split()))

def gcd(a,b):

  if b == 0:

    return a

  return gcd(b,a % b)

def lcm(a,b):

  return a * b // gcd(a,b)

if k % 2 != 0:

  elements = n // k

  print((elements**3))

else:

  a = n // k

  b = (n + (k//2)) // k

  print((a**3 + b ** 3))
n, k = list(map(int, input().split()))
num = [0] * k
ans = 0
for i in range(1, n + 1):
    num[i % k] += 1
for a in range(k):
    b = (k - a) % k
    c = (k - a) % k
    if (b + c) % k != 0:
        continue
    ans += num[a] * num[b] * num[c]
print(ans)

n, k = list(map(int, input().split()))


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


if k % 2 != 0:
    elements = n // k
    print((elements**3))
else:
    a = n // k
    b = (n + (k // 2)) // k
    print((a**3 + b**3))

-num = [0] * k -ans = 0 -for i in range(1, n + 1): -    num[i % k] += 1 -for a in range(k): -    b = (k - a) % k -    c = (k - a) % k -    if (b + c) % k != 0: -        continue -    ans += num[a] * num[b] * num[c] -print(ans) + + +def gcd(a, b): +    if b == 0: +        return a +    return gcd(b, a % b) + + +def lcm(a, b): +    return a * b // gcd(a, b) + + +if k % 2 != 0: +    elements = n // k +    print((elements**3)) +else: +    a = n // k +    b = (n + (k // 2)) // k +    print((a**3 + b**3))