n,k = list(map(int, input().split()))

kk = 2*k

if k % 2:

    tmp = (n//k)**3

    print(tmp)

    exit()

kk = 0

k2 = 0

kkk = 0

for i in range(k//2,n+1):

    if i % k == 0:

        kk += 1

    if i % k == k//2:

        k2 += 1

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

        kkk += 1

    # print(i, kk, k2, kkk)



print((kk**3 + k2**3 - kkk**3))

n,k = list(map(int, input().split()))

a = 0

b = 0

c = 0

kk = k // 2

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

    d = 2*i

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

        a += 1

    if i % k == 0:

        b += 1

    if (k % 2 == 0 and i % k == kk) and i % k == 0:

        c += 1



print((a**3 + b**3 - c**3))

# print(a,b,c)
n, k = list(map(int, input().split()))
kk = 2 * k
if k % 2:
    tmp = (n // k) ** 3
    print(tmp)
    exit()
kk = 0
k2 = 0
kkk = 0
for i in range(k // 2, n + 1):
    if i % k == 0:
        kk += 1
    if i % k == k // 2:
        k2 += 1
    if i % k == 0 and i % k == k // 2:
        kkk += 1
    # print(i, kk, k2, kkk)
print((kk**3 + k2**3 - kkk**3))

n, k = list(map(int, input().split()))
a = 0
b = 0
c = 0
kk = k // 2
for i in range(1, n + 1):
    d = 2 * i
    if k % 2 == 0 and i % k == kk:
        a += 1
    if i % k == 0:
        b += 1
    if (k % 2 == 0 and i % k == kk) and i % k == 0:
        c += 1
print((a**3 + b**3 - c**3))
# print(a,b,c)

-kk = 2 * k -if k % 2: -    tmp = (n // k) ** 3 -    print(tmp) -    exit() -kk = 0 -k2 = 0 -kkk = 0 -for i in range(k // 2, n + 1): +a = 0 +b = 0 +c = 0 +kk = k // 2 +for i in range(1, n + 1): +    d = 2 * i +    if k % 2 == 0 and i % k == kk: +        a += 1 -        kk += 1 -    if i % k == k // 2: -        k2 += 1 -    if i % k == 0 and i % k == k // 2: -        kkk += 1 -    # print(i, kk, k2, kkk) -print((kk**3 + k2**3 - kkk**3)) +        b += 1 +    if (k % 2 == 0 and i % k == kk) and i % k == 0: +        c += 1 +print((a**3 + b**3 - c**3)) +# print(a,b,c)