N, K = list(map(int, input().split()))

if K % 2 == 1:

    print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3))

else:

    print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3 + sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3))

N, K = list(map(int, input().split()))

ans = (N // K) ** 3

ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0

print(ans)
N, K = list(map(int, input().split()))
if K % 2 == 1:
    print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3))
else:
    print(
        (
            sum(1 for n in range(1, N + 1) if n % K == 0) ** 3
            + sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3
        )
    )

N, K = list(map(int, input().split()))
ans = (N // K) ** 3
ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0
print(ans)

-if K % 2 == 1: -    print((sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)) -else: -    print( -        ( -            sum(1 for n in range(1, N + 1) if n % K == 0) ** 3 -            + sum(1 for n in range(1, N + 1) if n % K == K // 2) ** 3 -        ) -    ) +ans = (N // K) ** 3 +ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0 +print(ans)