N, K = list(map(int, input().split()))

div, rem = divmod(N, K)

mods = [div + (0 < i <= rem) for i in range(K)]

total = 0

for mod_a in range(K):

    mod_b = (K - mod_a) % K

    mod_c = (K - mod_b) % K

    if mod_b == mod_c:

        total += mods[mod_a] * mods[mod_b] * mods[mod_c]

print(total)
N, K = list(map(int, input().split()))

div, rem = divmod(N, K)

mods = [div + (0 < i <= rem) for i in range(K)]

total = mods[0] ** 3

if not K & 1:

    total += mods[K >> 1] ** 3

print(total)
N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = 0
for mod_a in range(K):
    mod_b = (K - mod_a) % K
    mod_c = (K - mod_b) % K
    if mod_b == mod_c:
        total += mods[mod_a] * mods[mod_b] * mods[mod_c]
print(total)

N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = mods[0] ** 3
if not K & 1:
    total += mods[K >> 1] ** 3
print(total)

-total = 0 -for mod_a in range(K): -    mod_b = (K - mod_a) % K -    mod_c = (K - mod_b) % K -    if mod_b == mod_c: -        total += mods[mod_a] * mods[mod_b] * mods[mod_c] +total = mods[0] ** 3 +if not K & 1: +    total += mods[K >> 1] ** 3