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

a = n / k

b = n/k + (1 if 0 < k / 2 <= n % k else 0)

print(a ** 3 + (b ** 3 if k % 2 == 0 else 0))
n,k = list(map(int, input().split(' ')))

a,b = n / k,  n / k + (1 if 0 < k / 2 <= n % k else 0)

print(a ** 3 + (b ** 3 if k % 2 == 0 else 0))
n, k = list(map(int, input().split(" ")))
a = n / k
b = n / k + (1 if 0 < k / 2 <= n % k else 0)
print(a**3 + (b**3 if k % 2 == 0 else 0))

n, k = list(map(int, input().split(" ")))
a, b = n / k, n / k + (1 if 0 < k / 2 <= n % k else 0)
print(a**3 + (b**3 if k % 2 == 0 else 0))

-a = n / k -b = n / k + (1 if 0 < k / 2 <= n % k else 0) +a, b = n / k, n / k + (1 if 0 < k / 2 <= n % k else 0)