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

c=0

s = k if k%2==1 else k//2

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

    s2 = k if i%k==0 else s

    n2 = (n-s2)//k+1

    c+=n2**2

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

s = k if k%2==1 else k//2

l = (n-s)//s+1

n1=(n-s)//k+1

n2=(n-k)//k+1

if l%2==0:

    print((l*(n1**2+n2**2)//2))

else:

    print(((l//2)*(n1**2+n2**2)+n1**2))
n, k = list(map(int, input().split()))
c = 0
s = k if k % 2 == 1 else k // 2
for i in range(s, n + 1, s):
    s2 = k if i % k == 0 else s
    n2 = (n - s2) // k + 1
    c += n2**2
print(c)

n, k = list(map(int, input().split()))
s = k if k % 2 == 1 else k // 2
l = (n - s) // s + 1
n1 = (n - s) // k + 1
n2 = (n - k) // k + 1
if l % 2 == 0:
    print((l * (n1**2 + n2**2) // 2))
else:
    print(((l // 2) * (n1**2 + n2**2) + n1**2))

-c = 0 -for i in range(s, n + 1, s): -    s2 = k if i % k == 0 else s -    n2 = (n - s2) // k + 1 -    c += n2**2 -print(c) +l = (n - s) // s + 1 +n1 = (n - s) // k + 1 +n2 = (n - k) // k + 1 +if l % 2 == 0: +    print((l * (n1**2 + n2**2) // 2)) +else: +    print(((l // 2) * (n1**2 + n2**2) + n1**2))