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

odd = []

even1 = []

even2 = []

if K % 2 == 1:

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

        if i % K == 0:

            odd += [i]

    ans = len(odd) ** 3

else:

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

        if i % K == 0:

            even1 += [i]

        elif i % (K/2) == 0:

            even2 += [i]

    ans = len(even1) ** 3 + len(even2) ** 3

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

ary1 = []

ary2 = []

if K % 2 == 1:

    for i in range(K,N+1,K):

        ary1 += [i]

    print((len(ary1)**3))

else:

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

        if i % K == 0:

            ary1 += [i]

        elif i % (K//2) == 0:

            ary2 += [i]

    print(((len(ary1) ** 3) + (len(ary2) ** 3)))

N, K = list(map(int, input().split()))
odd = []
even1 = []
even2 = []
if K % 2 == 1:
    for i in range(1, N + 1):
        if i % K == 0:
            odd += [i]
    ans = len(odd) ** 3
else:
    for i in range(1, N + 1):
        if i % K == 0:
            even1 += [i]
        elif i % (K / 2) == 0:
            even2 += [i]
    ans = len(even1) ** 3 + len(even2) ** 3
print(ans)

N, K = list(map(int, input().split()))
ary1 = []
ary2 = []
if K % 2 == 1:
    for i in range(K, N + 1, K):
        ary1 += [i]
    print((len(ary1) ** 3))
else:
    for i in range(1, N + 1):
        if i % K == 0:
            ary1 += [i]
        elif i % (K // 2) == 0:
            ary2 += [i]
    print(((len(ary1) ** 3) + (len(ary2) ** 3)))

-odd = [] -even1 = [] -even2 = [] +ary1 = [] +ary2 = [] -    for i in range(1, N + 1): -        if i % K == 0: -            odd += [i] -    ans = len(odd) ** 3 +    for i in range(K, N + 1, K): +        ary1 += [i] +    print((len(ary1) ** 3)) -            even1 += [i] -        elif i % (K / 2) == 0: -            even2 += [i] -    ans = len(even1) ** 3 + len(even2) ** 3 -print(ans) +            ary1 += [i] +        elif i % (K // 2) == 0: +            ary2 += [i] +    print(((len(ary1) ** 3) + (len(ary2) ** 3)))