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

ans = 0

q, r = divmod(n, k)

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

    b = k - a%k

    c = k - b%k

    if (c + a)%k == 0:

        now = 1

        if 1 <= b%k <= r: now *= q+1

        else: now *= q

        if 1 <= c%k <= r: now *= q+1

        else: now *= q

        ans += now

print(ans)

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

f = n//k

ans = f**3

if k%2 == 0:

    h = n//(k//2) - f

    ans += h**3

print(ans)

n, k = list(map(int, input().split()))
ans = 0
q, r = divmod(n, k)
for a in range(1, n + 1):
    b = k - a % k
    c = k - b % k
    if (c + a) % k == 0:
        now = 1
        if 1 <= b % k <= r:
            now *= q + 1
        else:
            now *= q
        if 1 <= c % k <= r:
            now *= q + 1
        else:
            now *= q
        ans += now
print(ans)

n, k = list(map(int, input().split()))
f = n // k
ans = f**3
if k % 2 == 0:
    h = n // (k // 2) - f
    ans += h**3
print(ans)

-ans = 0 -q, r = divmod(n, k) -for a in range(1, n + 1): -    b = k - a % k -    c = k - b % k -    if (c + a) % k == 0: -        now = 1 -        if 1 <= b % k <= r: -            now *= q + 1 -        else: -            now *= q -        if 1 <= c % k <= r: -            now *= q + 1 -        else: -            now *= q -        ans += now +f = n // k +ans = f**3 +if k % 2 == 0: +    h = n // (k // 2) - f +    ans += h**3