import math

import sys

import queue

from collections import Counter

from itertools import accumulate

from fractions import gcd

from functools import reduce





def lcm(a, b):

    return a * b // gcd(a, b)



def combination_count(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



def permutations_count(n, r):

    return math.factorial(n) // math.factorial(n - r)



sys.setrecursionlimit(10000)



mod = 1000000007



"""

# 0埋め, 小数点出力桁指定時のときの出力

a = 100

b = 0.987654321

print("{0:06d}-{1:6f}".format(a,b))

000100-0.987654



# 文字列をリストに格納

char_list = list("abcd") # ["a","b","c","d"]



# 標準入力取得

## 文字列

    = sys.stdin.readline().rstrip()

    = list(sys.stdin.readline().rstrip())



## 数値

    = int(sys.stdin.readline())

    = map(int, sys.stdin.readline().split())

    = list(map(int, sys.stdin.readline().split()))

    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]

"""



# Kの倍数を全網羅する方針？

# 最大長は3N

# 2, 4, 6, 8

if __name__ == "__main__":

    N, K = list(map(int, sys.stdin.readline().split()))

    if K % 2 == 0:

        a = N // K

        b = (N + (K // 2)) // K

        print((a ** 3 + b ** 3))

    else:

        a = N // K

        print((a ** 3))



import math

import sys

import queue

from collections import Counter

from itertools import accumulate

from fractions import gcd

from functools import reduce





def lcm(a, b):

    return a * b // gcd(a, b)



def combination_count(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



def permutations_count(n, r):

    return math.factorial(n) // math.factorial(n - r)



sys.setrecursionlimit(10000)



mod = 1000000007



"""

# 0埋め, 小数点出力桁指定時のときの出力

a = 100

b = 0.987654321

print("{0:06d}-{1:6f}".format(a,b))

000100-0.987654



# 文字列をリストに格納

char_list = list("abcd") # ["a","b","c","d"]



# 標準入力取得

## 文字列

    = sys.stdin.readline().rstrip()

    = list(sys.stdin.readline().rstrip())



## 数値

    = int(sys.stdin.readline())

    = map(int, sys.stdin.readline().split())

    = list(map(int, sys.stdin.readline().split()))

    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]

"""



# Kの倍数を全網羅する方針？

# 最大長は3N

# 2, 4, 6, 8

if __name__ == "__main__":

    N, K = list(map(int, sys.stdin.readline().split()))

    if K % 2 == 0:

        a = N // K

        # b = (N + (K // 2)) // K

        b = N // (K // 2) - a

        print((a ** 3 + b ** 3))

    else:

        a = N // K

        print((a ** 3))



import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)


def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


sys.setrecursionlimit(10000)
mod = 1000000007
"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654
# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())
## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
# Kの倍数を全網羅する方針？
# 最大長は3N
# 2, 4, 6, 8
if __name__ == "__main__":
    N, K = list(map(int, sys.stdin.readline().split()))
    if K % 2 == 0:
        a = N // K
        b = (N + (K // 2)) // K
        print((a**3 + b**3))
    else:
        a = N // K
        print((a**3))

import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)


def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


sys.setrecursionlimit(10000)
mod = 1000000007
"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654
# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())
## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
# Kの倍数を全網羅する方針？
# 最大長は3N
# 2, 4, 6, 8
if __name__ == "__main__":
    N, K = list(map(int, sys.stdin.readline().split()))
    if K % 2 == 0:
        a = N // K
        # b = (N + (K // 2)) // K
        b = N // (K // 2) - a
        print((a**3 + b**3))
    else:
        a = N // K
        print((a**3))

-        b = (N + (K // 2)) // K +        # b = (N + (K // 2)) // K +        b = N // (K // 2) - a