import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy



sys.setrecursionlimit(10**7)

inf=10**20

mod=10**9+7

dd=[(-1,0),(0,1),(1,0),(0,-1)]

ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())

def LS(): return sys.stdin.readline().split()

def S(): return eval(input())



def main():

  n,k=LI()



  ans=0

  ans+=(n//k)**3



  if k%2==0:

    _a=0

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

      if i%k==k//2:

        _a+=1

    ans+=_a**3



  return ans



# main()

print((main()))

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy



sys.setrecursionlimit(10**7)

inf=10**20

mod=10**9+7

dd=[(-1,0),(0,1),(1,0),(0,-1)]

ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]



def LI(): return [int(x) for x in sys.stdin.readline().split()]

# def LF(): return [float(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())

def F(): return float(sys.stdin.readline())

def LS(): return sys.stdin.readline().split()

def S(): return eval(input())



def main():

  n,k=LI()

  if k%2==0:

    return (n//(k//2)-(n//k))**3+(n//k)**3

  return (n//k)**3



# main()

print((main()))

import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def I():
    return int(sys.stdin.readline())


def LS():
    return sys.stdin.readline().split()


def S():
    return eval(input())


def main():
    n, k = LI()
    ans = 0
    ans += (n // k) ** 3
    if k % 2 == 0:
        _a = 0
        for i in range(1, n + 1):
            if i % k == k // 2:
                _a += 1
        ans += _a**3
    return ans


# main()
print((main()))

import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I():
    return int(sys.stdin.readline())


def F():
    return float(sys.stdin.readline())


def LS():
    return sys.stdin.readline().split()


def S():
    return eval(input())


def main():
    n, k = LI()
    if k % 2 == 0:
        return (n // (k // 2) - (n // k)) ** 3 + (n // k) ** 3
    return (n // k) ** 3


# main()
print((main()))

-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy +import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy -def LI_(): -    return [int(x) - 1 for x in sys.stdin.readline().split()] +# def LF(): return [float(x) for x in sys.stdin.readline().split()] +def I(): +    return int(sys.stdin.readline()) -def I(): -    return int(sys.stdin.readline()) +def F(): +    return float(sys.stdin.readline()) -    ans = 0 -    ans += (n // k) ** 3 -        _a = 0 -        for i in range(1, n + 1): -            if i % k == k // 2: -                _a += 1 -        ans += _a**3 -    return ans +        return (n // (k // 2) - (n // k)) ** 3 + (n // k) ** 3 +    return (n // k) ** 3