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



if k%2 == 1:

    cnts = []

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

        if i % k == 0:

            cnts.append(i)

    print((len(cnts)**3))

else:

    k0 = 0

    k1 = 0

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

        if i % k == 0:

            k0 += 1

        elif i %k == k//2:

            k1 += 1

    print((k0**3 + k1**3))
n,k = list(map(int,input().split()))

a = 0

a2 = 0

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

    if i % k == 0:

        a += 1

    elif 2*i % k == 0:

        a2 += 1

print((a**3 + a2**3))
n, k = list(map(int, input().split()))
if k % 2 == 1:
    cnts = []
    for i in range(1, n + 1):
        if i % k == 0:
            cnts.append(i)
    print((len(cnts) ** 3))
else:
    k0 = 0
    k1 = 0
    for i in range(1, n + 1):
        if i % k == 0:
            k0 += 1
        elif i % k == k // 2:
            k1 += 1
    print((k0**3 + k1**3))

n, k = list(map(int, input().split()))
a = 0
a2 = 0
for i in range(1, n + 1):
    if i % k == 0:
        a += 1
    elif 2 * i % k == 0:
        a2 += 1
print((a**3 + a2**3))

-if k % 2 == 1: -    cnts = [] -    for i in range(1, n + 1): -        if i % k == 0: -            cnts.append(i) -    print((len(cnts) ** 3)) -else: -    k0 = 0 -    k1 = 0 -    for i in range(1, n + 1): -        if i % k == 0: -            k0 += 1 -        elif i % k == k // 2: -            k1 += 1 -    print((k0**3 + k1**3)) +a = 0 +a2 = 0 +for i in range(1, n + 1): +    if i % k == 0: +        a += 1 +    elif 2 * i % k == 0: +        a2 += 1 +print((a**3 + a2**3))