n, k = [int(i) for i in input().split()]



ans = [0, 0]

d = k // 2



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

    if k % 2 == 0 and i % k == d:

        ans[0] += 1

    if i % k == 0:

        ans[1] += 1



print((ans[0] ** 3 + ans[1] ** 3))
n, k = [int(i) for i in input().split()]



ans = (n // k) ** 3

if k % 2 == 0:

  ans += ((n - k // 2) // k + 1) ** 3



print(ans)
n, k = [int(i) for i in input().split()]
ans = [0, 0]
d = k // 2
for i in range(1, n + 1):
    if k % 2 == 0 and i % k == d:
        ans[0] += 1
    if i % k == 0:
        ans[1] += 1
print((ans[0] ** 3 + ans[1] ** 3))

n, k = [int(i) for i in input().split()]
ans = (n // k) ** 3
if k % 2 == 0:
    ans += ((n - k // 2) // k + 1) ** 3
print(ans)

-ans = [0, 0] -d = k // 2 -for i in range(1, n + 1): -    if k % 2 == 0 and i % k == d: -        ans[0] += 1 -    if i % k == 0: -        ans[1] += 1 -print((ans[0] ** 3 + ans[1] ** 3)) +ans = (n // k) ** 3 +if k % 2 == 0: +    ans += ((n - k // 2) // k + 1) ** 3 +print(ans)