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



s = []

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

    if (2 * a) % k == 0:

        s.append(a)



t = []

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

    if a % k == 0:

        t.append(a)



print(((len(s) - len(t)) ** 3 + len(t) ** 3))
n, k = list(map(int, input().split()))



x = 0

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

    if (2 * a) % k == 0:

        x += 1



y = 0

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

    if a % k == 0:

        y += 1



print(((x - y) ** 3 + y ** 3))

n, k = list(map(int, input().split()))
s = []
for a in range(1, n + 1):
    if (2 * a) % k == 0:
        s.append(a)
t = []
for a in range(1, n + 1):
    if a % k == 0:
        t.append(a)
print(((len(s) - len(t)) ** 3 + len(t) ** 3))

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

-s = [] +x = 0 -        s.append(a) -t = [] +        x += 1 +y = 0 -        t.append(a) -print(((len(s) - len(t)) ** 3 + len(t) ** 3)) +        y += 1 +print(((x - y) ** 3 + y**3))