def iin(): return int(eval(input()))

def nl(): return list(map(int, input().split()))

def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]



n, k = nl()



d = dict()

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

    t = i % k

    d[t] = d.get(t, 0) + 1



ans = 0

if k % 2 == 0:

    ans += d.get(k // 2, 0) ** 3

ans += d.get(0, 0) ** 3

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



ans = 0

if k % 2 == 0:

    ans += ((n - k // 2) // k + 1) ** 3

ans += (n // k) ** 3

print(ans)
def iin():
    return int(eval(input()))


def nl():
    return list(map(int, input().split()))


def ary(r, c, v):
    return [[v for _ in range(c)] for _ in range(r)]


n, k = nl()
d = dict()
for i in range(1, n + 1):
    t = i % k
    d[t] = d.get(t, 0) + 1
ans = 0
if k % 2 == 0:
    ans += d.get(k // 2, 0) ** 3
ans += d.get(0, 0) ** 3
print(ans)

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

-def iin(): -    return int(eval(input())) - - -def nl(): -    return list(map(int, input().split())) - - -def ary(r, c, v): -    return [[v for _ in range(c)] for _ in range(r)] - - -n, k = nl() -d = dict() -for i in range(1, n + 1): -    t = i % k -    d[t] = d.get(t, 0) + 1 +n, k = list(map(int, input().split())) -    ans += d.get(k // 2, 0) ** 3 -ans += d.get(0, 0) ** 3 +    ans += ((n - k // 2) // k + 1) ** 3 +ans += (n // k) ** 3