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



# num[x]:kで割ってxあまる数が1以上N以下に何個あるか

num = [0 for _ in range(k)]

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

    num[i % k] += 1



res = 0

for a in range(k):

    b = (k - a) % k

    c = (k - a) % k

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

        continue

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



print(res)

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



if k % 2 != 0:

    x = n // k

    print((x ** 3))

else:

    x = n // k

    y = 0

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

        if i % k == k // 2:

            y += 1

    print((x ** 3 + y ** 3))

n, k = list(map(int, input().split()))
# num[x]:kで割ってxあまる数が1以上N以下に何個あるか
num = [0 for _ in range(k)]
for i in range(1, n + 1):
    num[i % k] += 1
res = 0
for a in range(k):
    b = (k - a) % k
    c = (k - a) % k
    if (b + c) % k != 0:
        continue
    res += num[a] * num[b] * num[c]
print(res)

n, k = list(map(int, input().split()))
if k % 2 != 0:
    x = n // k
    print((x**3))
else:
    x = n // k
    y = 0
    for i in range(1, n + 1):
        if i % k == k // 2:
            y += 1
    print((x**3 + y**3))

-# num[x]:kで割ってxあまる数が1以上N以下に何個あるか -num = [0 for _ in range(k)] -for i in range(1, n + 1): -    num[i % k] += 1 -res = 0 -for a in range(k): -    b = (k - a) % k -    c = (k - a) % k -    if (b + c) % k != 0: -        continue -    res += num[a] * num[b] * num[c] -print(res) +if k % 2 != 0: +    x = n // k +    print((x**3)) +else: +    x = n // k +    y = 0 +    for i in range(1, n + 1): +        if i % k == k // 2: +            y += 1 +    print((x**3 + y**3))