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

if K%2==1:

    n = N//K

    ans = n**3

else:

    n1 = N//K

    n2 = 1+(N-K//2)//K

    ans = n1**3+n2**3

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

L = N//K

if K%2==1:

    print((L**3))

else:

    M = N//(K//2)

    M -= L

    print((L**3+M**3))
N, K = list(map(int, input().split()))
if K % 2 == 1:
    n = N // K
    ans = n**3
else:
    n1 = N // K
    n2 = 1 + (N - K // 2) // K
    ans = n1**3 + n2**3
print(ans)

N, K = list(map(int, input().split()))
L = N // K
if K % 2 == 1:
    print((L**3))
else:
    M = N // (K // 2)
    M -= L
    print((L**3 + M**3))

+L = N // K -    n = N // K -    ans = n**3 +    print((L**3)) -    n1 = N // K -    n2 = 1 + (N - K // 2) // K -    ans = n1**3 + n2**3 -print(ans) +    M = N // (K // 2) +    M -= L +    print((L**3 + M**3))