

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



no_rem = 0

rem_half = 0



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

    no_rem += 1 if i % k == 0 else 0



    rem_half += 1 if k%2 == 0 and i%k == k//2 else 0



print((no_rem ** 3 + rem_half**3))

    


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



def solve1():

    no_rem = 0

    rem_half = 0



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

        no_rem += 1 if i % k == 0 else 0



        rem_half += 1 if k%2 == 0 and i%k == k//2 else 0



    print((no_rem ** 3 + rem_half**3))

    



def solve2():

    no_rem = n//k



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

    print((no_rem**3 + rem_half**3))



solve2()
n, k = list(map(int, input().split()))
no_rem = 0
rem_half = 0
for i in range(1, n + 1):
    no_rem += 1 if i % k == 0 else 0
    rem_half += 1 if k % 2 == 0 and i % k == k // 2 else 0
print((no_rem**3 + rem_half**3))

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


def solve1():
    no_rem = 0
    rem_half = 0
    for i in range(1, n + 1):
        no_rem += 1 if i % k == 0 else 0
        rem_half += 1 if k % 2 == 0 and i % k == k // 2 else 0
    print((no_rem**3 + rem_half**3))


def solve2():
    no_rem = n // k
    rem_half = 0 if k % 2 == 1 else (n + k // 2) // k
    print((no_rem**3 + rem_half**3))


solve2()

-no_rem = 0 -rem_half = 0 -for i in range(1, n + 1): -    no_rem += 1 if i % k == 0 else 0 -    rem_half += 1 if k % 2 == 0 and i % k == k // 2 else 0 -print((no_rem**3 + rem_half**3)) + + +def solve1(): +    no_rem = 0 +    rem_half = 0 +    for i in range(1, n + 1): +        no_rem += 1 if i % k == 0 else 0 +        rem_half += 1 if k % 2 == 0 and i % k == k // 2 else 0 +    print((no_rem**3 + rem_half**3)) + + +def solve2(): +    no_rem = n // k +    rem_half = 0 if k % 2 == 1 else (n + k // 2) // k +    print((no_rem**3 + rem_half**3)) + + +solve2()