import sys

import itertools

import numpy

input = sys.stdin.readline

N,K = [int(i) for i in input().split()]

if K % 2 == 1 :

    index = N // K

    ans = index**3

else :

    index = N // K

    ans = index**3

    k = K // 2

    indexa = (N // k) - index

    ans += indexa**3

print(ans)
#template

def inputlist(): return [int(k) for k in input().split()]

#template

N,K = inputlist()

m0 = 0

mh = 0

ans = 0

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

    d = i%K

    if d == 0:

        m0+=1

    if d == K//2 and K % 2 == 0:

        mh +=1

print((m0**3 + mh**3))
import sys
import itertools
import numpy

input = sys.stdin.readline
N, K = [int(i) for i in input().split()]
if K % 2 == 1:
    index = N // K
    ans = index**3
else:
    index = N // K
    ans = index**3
    k = K // 2
    indexa = (N // k) - index
    ans += indexa**3
print(ans)

# template
def inputlist():
    return [int(k) for k in input().split()]


# template
N, K = inputlist()
m0 = 0
mh = 0
ans = 0
for i in range(1, N + 1):
    d = i % K
    if d == 0:
        m0 += 1
    if d == K // 2 and K % 2 == 0:
        mh += 1
print((m0**3 + mh**3))

-import sys -import itertools -import numpy +# template +def inputlist(): +    return [int(k) for k in input().split()] -input = sys.stdin.readline -N, K = [int(i) for i in input().split()] -if K % 2 == 1: -    index = N // K -    ans = index**3 -else: -    index = N // K -    ans = index**3 -    k = K // 2 -    indexa = (N // k) - index -    ans += indexa**3 -print(ans) + +# template +N, K = inputlist() +m0 = 0 +mh = 0 +ans = 0 +for i in range(1, N + 1): +    d = i % K +    if d == 0: +        m0 += 1 +    if d == K // 2 and K % 2 == 0: +        mh += 1 +print((m0**3 + mh**3))