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)

total = div ** 3

if not K & 1:

    total += (div + (0 < K <= (rem << 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 = 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)
total = div**3
if not K & 1:
    total += (div + (0 < K <= (rem << 1))) ** 3
print(total)

-mods = [div + (0 < i <= rem) for i in range(K)] -total = mods[0] ** 3 +total = div**3 -    total += mods[K >> 1] ** 3 +    total += (div + (0 < K <= (rem << 1))) ** 3