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

if K%2==0:

    k = K//2

    o = (N+k)//K

    e = N//K

    ans = e**3+o**3

else:

    ans = (N//K)**3

print(ans)    
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()))
if K % 2 == 0:
    k = K // 2
    o = (N + k) // K
    e = N // K
    ans = e**3 + o**3
else:
    ans = (N // K) ** 3
print(ans)

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)

-if K % 2 == 0: -    k = K // 2 -    o = (N + k) // K -    e = N // K -    ans = e**3 + o**3 +if K % 2 == 1: +    n = N // K +    ans = n**3 -    ans = (N // K) ** 3 +    n1 = N // K +    n2 = 1 + (N - K // 2) // K +    ans = n1**3 + n2**3