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

ans = sum(((N + a % K) // K)**2 for a in range(1, N + 1) if (2 * a) % K == 0)

print(ans)
from math import ceil, floor

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

r = floor((2 * N) / K)

ans = floor(N / K)**3 if K % 2 == 1 \

    else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1)**2 + floor(r / 2) * floor(N / K)**2

print(ans)

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

from math import ceil, floor

N, K = map(int, input().split())
r = floor((2 * N) / K)
ans = (
    floor(N / K) ** 3
    if K % 2 == 1
    else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1) ** 2
    + floor(r / 2) * floor(N / K) ** 2
)
print(ans)

-N, K = list(map(int, input().split())) -ans = sum(((N + a % K) // K) ** 2 for a in range(1, N + 1) if (2 * a) % K == 0) +from math import ceil, floor + +N, K = map(int, input().split()) +r = floor((2 * N) / K) +ans = ( +    floor(N / K) ** 3 +    if K % 2 == 1 +    else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1) ** 2 +    + floor(r / 2) * floor(N / K) ** 2 +)