CodeEff/ECCO huggingface dataset:
# Original solution
N, K = list(map(int, input().strip().split()))
result = 0
num = N // K
result += num
if num == 2:
    result += num * (num - 1) * 3
elif num > 2:
    result += num * (num - 1) * 3
    result += num * (num - 1) * (num - 2)


if K % 2 == 1:
    print(result)
else:
    start = K // 2
    for a in range(start, N + 1, K):
        for b in range(a, N + 1, K):
            for c in range(b, N + 1, K):
                if a == b and b == c:
                    result += 1
                elif a == b or b == c:
                    result += 3
                else:
                    result += 6
    print(result)

# Optimized solution
N, K = list(map(int, input().strip().split()))
result = 0
num = N // K
result += num
if num == 2:
    result += num * (num - 1) * 3
elif num > 2:
    result += num * (num - 1) * 3
    result += num * (num - 1) * (num - 2)


if K % 2 == 1:
    print(result)
else:
    start = K // 2
    num = (N - start) // K + 1
    result += num
    if num == 2:
        result += num * (num - 1) * 3
    elif num > 2:
        result += num * (num - 1) * 3
        result += num * (num - 1) * (num - 2)
    print(result)
# Original solution
def check():
    a = []
    bDict2 = {}
    count = 0
    removeList = []
    N, K = [int(i) for i in input().split(' ')]
    for i in range(1,N+1):
        if (2*i)%K == 0:
            a.append(i)


    while a != []:
        temp = a[0]
        for i in a:
            if (temp+i)%K == 0:
                removeList.append(i)
                if str(temp) not in bDict2:
                    bDict2[str(temp)] = 1
                else:
                    bDict2[str(temp)] += 1  
                    
        for i in removeList:
            a.remove(i)
        removeList.clear()
            
    for i in bDict2:
        count += bDict2[i]**3

    print(count)
check()

# Optimized solution
N, K = list(map(int, input().split()))
cnt1,cnt2 = 0,0

for i in range(1,N+1):
    if i%K == 0:
        cnt1 += 1
    elif i%K == K/2:
        cnt2 += 1
print((cnt1**3+cnt2**3))
# Original solution
# -*- coding: utf-8 -*-
import itertools

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

Nlst = []
# for i in range(1,N+1):
#     Nlst.append(i)

if K % 2 == 0:
    for i in range(1,N+1):
        if i % K == 0 or i % (K/2) == 0:
            Nlst.append(i)
else:
    for i in range(1,N+1):
        if i % K == 0:
            Nlst.append(i)

tmplst = []
for i in itertools.product(Nlst, repeat=3):
    tmplst.append(i)

ans = 0

for (a,b,c) in tmplst:
    if (a+b) % K == 0 and (b+c) % K == 0 and (c+a) % K == 0:
        ans += 1


print(ans)


# Optimized solution
# -*- coding: utf-8 -*-
import itertools

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

Nlst = []
Nlst_gu = []
# for i in range(1,N+1):
#     Nlst.append(i)

if K % 2 == 0:
    for i in range(1,N+1):
        if i % K == 0:
            Nlst.append(i)
        elif i % (K/2) == 0:
            Nlst_gu.append(i)
else:
    for i in range(1,N+1):
        if i % K == 0:
            Nlst.append(i)
#
# print(Nlst)
# print(Nlst_gu)

ans = len(Nlst)
ans_gu = len(Nlst_gu)

print((ans * ans * ans + ans_gu * ans_gu * ans_gu))

#
# tmplst = []
# for i in itertools.product(Nlst, repeat=3):
#     tmplst.append(i)
#
# ans = 0
#
# for (a,b,c) in tmplst:
#     if (a+b) % K == 0 and (b+c) % K == 0 and (c+a) % K == 0:
#         ans += 1
#
#
# print(ans)
# Original solution
N,K=list(map(int,input().split()))
if K%2==1:
  print(((N//K)**3))
else:
  k=K//2
  ans=0
  for a in range(k,N+1,k):
    for b in range(a,N+1,k):
      for c in range(b,N+1,k):
        if (a+b)%K==0 and (b+c)%K==0 and (c+a)%K==0:
          if a==b==c:
            ans+=1
          elif a==b or b==c or c==a:
            ans+=3
          else:
            ans+=6
  print(ans)

# Optimized solution
N,K=list(map(int,input().split()))
if K%2==1:
  print(((N//K)**3))
else:
  k=K//2
  print(((N//K)**3+((N-k)//K+1)**3))
# Original solution
import sys
from functools import reduce
from operator import mul
import math

def nCr(n, r):
    r = min(r, n-r)
    upper = reduce(mul, list(range(n, n-r, -1)), 1)
    lower = reduce(mul, list(range(r, 0, -1)), 1)
    return upper // lower


def oddCaseK(n, k):
    cand = 0
    for x in range(1, n+1):
        if x % k == 0:
            cand += 1
    
    number_of_possibles = 0
    if cand >= 1:
        number_of_possibles += cand
    if cand >= 2:
        number_of_possibles += nCr(cand, 2) * nCr(2, 1) * 3
    if cand >= 3:
        number_of_possibles += nCr(cand, 3) * math.factorial(3)
    
    return number_of_possibles

    

def evenCaseK(n, k):
    cand1 = 0
    cand2 = 0
    for x in range(1, n+1):
        if x % k == 0:
            cand1 += 1
        elif x % k == k // 2:
            cand2 += 1
    
    number_of_possibles = 0
    number_of_possibles = 0
    if cand1 >= 1:
        number_of_possibles += cand1
    if cand1 >= 2:
        number_of_possibles += nCr(cand1, 2) * nCr(2, 1) * 3
    if cand1 >= 3:
        number_of_possibles += nCr(cand1, 3) * math.factorial(3)

    if cand2 >= 1:
        number_of_possibles += cand2
    if cand2 >= 2:
        number_of_possibles += nCr(cand2, 2) * nCr(2, 1) * 3
    if cand2 >= 3:
        number_of_possibles += nCr(cand2, 3) * math.factorial(3)

    return number_of_possibles


def main():
    n, k = [int(x) for x in sys.stdin.readline().split()]
    if k % 2 == 0:
        ans = evenCaseK(n, k)
    else:
        ans = oddCaseK(n, k)
    
    print(ans)



if __name__ == "__main__":
    main()





# Optimized solution
import sys
from functools import reduce
from operator import mul
import math

def nCr(n, r):
    r = min(r, n-r)
    upper = reduce(mul, list(range(n, n-r, -1)), 1)
    lower = reduce(mul, list(range(r, 0, -1)), 1)
    return upper // lower


def oddCaseK(n, k):
    cand = 0
    for x in range(1, n+1):
        if x % k == 0:
            cand += 1
    
    number_of_possibles = 0
    if cand >= 1:
        number_of_possibles += cand
    if cand >= 2:
        number_of_possibles += nCr(cand, 2) * nCr(2, 1) * 3
    if cand >= 3:
        number_of_possibles += nCr(cand, 3) * math.factorial(3)
    
    return number_of_possibles



def evenCaseK(n, k):
    cand1 = 0
    cand2 = 0
    for x in range(1, n+1):
        if x % k == 0:
            cand1 += 1
        elif x % k == k // 2:
            cand2 += 1
    
    number_of_possibles = 0
    for cand in [cand1, cand2]:
        if cand >= 1:
            number_of_possibles += cand
        if cand >= 2:
            number_of_possibles += nCr(cand, 2) * nCr(2, 1) * 3
        if cand >= 3:
            number_of_possibles += nCr(cand, 3) * math.factorial(3)

    return number_of_possibles


def main():
    n, k = [int(x) for x in sys.stdin.readline().split()]
    if k % 2 == 0:
        ans = evenCaseK(n, k)
    else:
        ans = oddCaseK(n, k)
    
    print(ans)



if __name__ == "__main__":
    main()
# Original solution
n, k = [int(i) for i in input().split()]

ans = [0, 0]
d = k // 2

for i in range(1, n+1):
    if k % 2 == 0 and i % k == d:
        ans[0] += 1
    if i % k == 0:
        ans[1] += 1

print((ans[0] ** 3 + ans[1] ** 3))

# Optimized solution
n, k = [int(i) for i in input().split()]

ans = (n // k) ** 3
if k % 2 == 0:
  ans += ((n - k // 2) // k + 1) ** 3

print(ans)
# Original solution
from math import *
n,k=list(map(int,input().split()))
dict1={}
flag=0
ans=0
if(k%3==0):
    flag=1
for i in range(1,n+1):
    try:
        dict1[i%k]+=1
    except:
        KeyError
        dict1[i%k]=1
dict2={}
for i in list(dict1.keys()):
    try:
        if(dict2[i]==1):
            a=1
    except:
        KeyError
        if((i+i)%k==0):
            ans+=dict1[i]*dict1[i]*dict1[i]
            dict2[i]=1
            dict2[k-i]=1
print(ans)

# Optimized solution
from math import *
n,k=list(map(int,input().split()))
dict1={}
flag=0
ans=0
if(k%3==0):
    flag=1
for i in range(1,n+1):
    try:
        dict1[i%k]+=1
    except:
        KeyError
        dict1[i%k]=1
for i in list(dict1.keys()):
    if((i+i)%k==0):
        ans+=dict1[i]*dict1[i]*dict1[i]

print(ans)
# Original solution
import itertools
n,k = list(map(int,input().split()))
if k%2!=0:
  ans = len(list(itertools.product(list(range(1,n//k+1)),repeat=3)))
  print(ans)
else:
  ans = len(list(itertools.product(list(range(1,n//k+1)),repeat=3))) + len(list(itertools.product(list(range(1,(2*n)//k-n//k+1)),repeat=3)))
  print(ans)

# Optimized solution
import itertools
n,k = list(map(int,input().split()))
if k%2!=0:
  ans = (n//k)**3
  print(ans)
else:
  ans = (n//k)**3 + ((2*n)//k - n//k)**3
  print(ans)
# Original solution
n,k = list(map(int,input().split()))
cnt = 0
cnt2 = 0
for i in range(1,n+1):
    if k%2 == 0:
        if i%k == 0:
            cnt += 1
        if i%k == k//2:
            cnt2 += 1 
    else:
        if i%k == 0:
            cnt += 1
print((cnt**3+cnt2**3))

# Optimized solution
n,k = list(map(int,input().split()))
if k%2 == 0:
    print(((n//k)**3+(n//(k//2)-n//k)**3))
else:
    print(((n//k)**3))
# Original solution
n,k = list(map(int, input().split()))
kk = 2*k
if k % 2:
    tmp = (n//k)**3
    print(tmp)
    exit()
kk = 0
k2 = 0
kkk = 0
for i in range(k//2,n+1):
    if i % k == 0:
        kk += 1
    if i % k == k//2:
        k2 += 1
    if i % k == 0 and i % k == k//2:
        kkk += 1
    # print(i, kk, k2, kkk)

print((kk**3 + k2**3 - kkk**3))


# Optimized solution
n,k = list(map(int, input().split()))
a = 0
b = 0
c = 0
kk = k // 2
for i in range(1,n+1):
    d = 2*i
    if k % 2 == 0 and i % k == kk:
        a += 1
    if i % k == 0:
        b += 1
    if (k % 2 == 0 and i % k == kk) and i % k == 0:
        c += 1

print((a**3 + b**3 - c**3))
# print(a,b,c)
# Original solution
import itertools as itr

N, K = tuple(int(i) for i in input().split())

n = int(N/K)
c1 = list(itr.product(list(range(n)), repeat=3))
c1 = len(c1)

k_2 = K/2

if N < k_2:
    print((0))
elif K%2 != 0:
    print(c1)
else:

    if N < n*K + k_2:
        c2 = list(itr.product(list(range(n)), repeat=3))
    else:
        c2 = list(itr.product(list(range(n+1)), repeat=3))

    c2 = len(c2)
    print((c1 + c2))

# Optimized solution
import math
def cc(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = tuple(int(i) for i in input().split())

n = int(N/K)
c1 = n**3

k_2 = K/2

if N < k_2:
    print((0))
elif K%2 != 0:
    print(c1)
else:

    if N < n*K + k_2:
        c2 = n**3
    else:
        c2 = (n+1)**3
    print((c1 + c2))
# Original solution
def Count(a,b,c,K):
    if (a+b)%K==0 and (a+c)%K==0 and (b+c)%K==0:
        return 1;
    else:
        return 0;

N,K=(int(i) for i in input().split())
count=0

for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            count=count+Count(i,j,k,K)
print(count)

# Optimized solution
N,K=(int(i) for i in input().split())
countG=0
count=0
if K%2==0:
    for i in range(1,N+1):
        if i%K==0:
            count+=1
        elif i%K==K/2:
            countG+=1
else:
    for i in range(1,N+1):
        if i%K==0:
            count+=1
print((count*count*count+countG*countG*countG))
# Original solution
N, K = list(map(int, input().split()))
from itertools import combinations_with_replacement

# a+b % K == 0
# b+c % K == 0
# c+a % K == 0

# a が Kで割り切れる場合
#   -> bもcもKで割り切れる
#   -> a,b,cともにKの倍数
#   -> Kの倍数の個数(N//K) ** 3

# a がKで割れきれない場合
#   -> 同じくbもcもKで割り切れない
#   Q. Kが奇数の場合
#     -> それを満たす(a,b,c)の組み合わせはあり得ない
#   よってKは偶数
#     K=2のとき例より (a,b,c)=(1,1,1),(1,3,3),...
#     K=4のとき(a,b,c)=(2,2,2),(2,6,6),...
#     K=6のとき(a,b,c)=(3,3,3),(3,3,9),...
#   よりa % K == K/2である必要がある
#     a = x*K+K/2 (x=0以上の整数)

num_double = N//K
if K % 2 == 1:
    # Kが奇数の場合
    #  (1) (a,b,c)ともにKの倍数
    print((num_double ** 3))
else:
    # Kが偶数の場合,
    #  (1) (a,b,c)ともにKの倍数
    #  (2) (a,b,c)がいずれも Kで割った余りがK/2となる
    s = K // 2
    nums = [a for a in range(s, N+1, K)]
    count = 0
    for a, b, c in combinations_with_replacement(nums, 3):
        if a == b and b == c:
            count += 1
        elif a == b or b == c:
            count += 3
        else:
            count += 6
    print((num_double ** 3 + count))


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


def combination(n, r):
    ans = 1
    for i in range(r):
        ans *= n - i
    for i in range(r):
        ans //= i + 1
    return ans


# a+b % K == 0
# b+c % K == 0
# c+a % K == 0

# a が Kで割り切れる場合
#   -> bもcもKで割り切れる
#   -> a,b,cともにKの倍数
#   -> Kの倍数の個数(N//K) ** 3

# a がKで割れきれない場合
#   -> 同じくbもcもKで割り切れない
#   Q. Kが奇数の場合
#     -> それを満たす(a,b,c)の組み合わせはあり得ない
#   よってKは偶数
#     K=2のとき例より (a,b,c)=(1,1,1),(1,3,3),...
#     K=4のとき(a,b,c)=(2,2,2),(2,6,6),...
#     K=6のとき(a,b,c)=(3,3,3),(3,3,9),...
#   よりa % K == K/2である必要がある
#     a = x*K+K/2 (x=0以上の整数)

num_double = N//K
if K % 2 == 1:
    # Kが奇数の場合
    #  (1) (a,b,c)ともにKの倍数
    print((num_double ** 3))
else:
    # Kが偶数の場合,
    #  (1) (a,b,c)ともにKの倍数
    #  (2) (a,b,c)がいずれも Kで割った余りがK/2となる
    s = K // 2
    nums = [a for a in range(s, N+1, K)]
    n = len(nums)
    count = 0
    count += 6 * combination(n, 3)  # a,b,cがいずれも異なる値になるケースはnC3通り 順列は6倍
    count += 3 * n * (n-1)   # a,b,cのうち2つが同じ値になるケースはn(n-1)通り 順列は3倍
    count += n  # a,b,cが同じ値になるケースはn通り
    print((num_double ** 3 + count))
# Original solution
import math
n, k = list(map(int, input().split()))
a = int(n/k)
if(a < 2):
    b = 0
else:
    b = math.factorial(a) // (math.factorial(a - 2) * math.factorial(2))
if(a < 3):
    c = 0
else:
    c = math.factorial(a) // (math.factorial(a - 3) * math.factorial(3))
ans = a + b * 6 + c * 6
if(k % 2 == 0):
    t = int(k / 2)
    if(a * k + t > n):
      ans = ans * 2
    else:
      d = a + 1
      if(d < 2):
          e = 0
      else:
          e = math.factorial(d) // (math.factorial(d - 2) * math.factorial(2))
      if(d < 3):
          f = 0
      else:
          f = math.factorial(d) // (math.factorial(d - 3) * math.factorial(3))
      ans += (d + e * 6 + f * 6)
print(ans)

# Optimized solution
import math

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

ans = int(math.pow(int(n/k),3))

if(k % 2 == 0):
  m = int( (n+int(k/2))/ k )
  ans += int(math.pow(m,3))

print(ans)
# Original solution
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1,r + 1)))
    return over // under
N,K=list(map(int,input().split()))
if K%2==0:
    print(((N//K)**3+(((N-K//2)//K+1)**3)))
else:
    print(((N//K)**3))

# Optimized solution
N,K=list(map(int,input().split()))
if K%2==0:
    print(((N//K)**3+(((N-K//2)//K+1)**3)))
else:
    print(((N//K)**3))
# Original solution
N, K = list(map(int, input().split()))

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    for i in range(K, N+1, K):
        full.append(i)
    # print(full)
    ans = len(full) ** 3

    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        half.append(i)
        half = list(set(half) - set(full))
    # print(half)
    ans += len(half) ** 3


print(ans)

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

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        if i % K == 0:
            full.append(i)
        else:
            half.append(i)

    ans = len(half) ** 3 + len(full) ** 3

print(ans)
# Original solution
n,k = list(map(int,input().split()))

if k%2 == 1:
    cnts = []
    for i in range(1,n+1):
        if i % k == 0:
            cnts.append(i)
    print((len(cnts)**3))
else:
    k0 = 0
    k1 = 0
    for i in range(1,n+1):
        if i % k == 0:
            k0 += 1
        elif i %k == k//2:
            k1 += 1
    print((k0**3 + k1**3))

# Optimized solution
n,k = list(map(int,input().split()))
a = 0
a2 = 0
for i in range(1,n+1):
    if i % k == 0:
        a += 1
    elif 2*i % k == 0:
        a2 += 1
print((a**3 + a2**3))
# Original solution
import itertools
N, K = list(map(int, input().split()))
seq = list(range(1,N + 1))
cand = list(itertools.product(seq, repeat=3))
ans = 0
for c in cand:
  ab = c[0] + c[1]
  bc = c[1] + c[2]
  ca = c[2] + c[0]
  if ab % K == 0 and bc % K == 0 and ca % K == 0:
    ans += 1
print(ans)

# Optimized solution
N, K = list(map(int, input().split()))
p1 = N // K
p2 = 0
if K % 2 == 0:
  p2 = (N + (K // 2)) // K
print((p1**3 + p2**3))
# Original solution
from itertools import*
n, k = list(map(int, input().split()))
a, b = divmod(n, k)
t = 0 if k%2 else a + (b >= k//2)
j = lambda i: len(list(product(list(range(i)), repeat=3)))
print((j(a)+j(t)))

# Optimized solution
n,k=list(map(int,input().split()))
print(((n//k) ** 3 + (k%2 == 0) * ((n + k//2) // k) ** 3))
# Original solution
import collections
n,k=list(map(int,input().split()))
l_n=[(v+1)%k for v in range(n)]
c = collections.Counter(l_n)
m = len(c)
ret=0
for i in range(0,m):
    for j in range(0,m):
        if (i+j)%k==0:
            for r in range(0,m):
                if (i+r)%k ==0 and (r+j)%k==0:
                    ret+=c[i]*c[j]*c[r]
print(ret)
            
    


# Optimized solution
n, k = list(map(int, input().split()))
print((sum([1 if v % k == 0 else 0 for v in range(1, n+1)])**3 +
      sum([1 if v % k == k/2 else 0 for v in range(1, n+1)])**3))
# Original solution
def logic(N, K):
    if K == 1:
        return N**3
    count = 0
    for a in range(1, N + 1):
        b_s = K - (a % K)
        for b in range(b_s, N + 1, K):
            for c in range(b_s, N + 1, K):
                if (b + c) % K == 0:
                    count += 1
    return count

def main():
    N, K = list(map(int, input().split()))
    print((logic(N, K)))

if __name__ == '__main__':
    main()

# Optimized solution
N, K = list(map(int,input().split()))
print((int(N/K)**3+[int((N+K/2)/K)**3,0][K%2]))
# Original solution
n,k = (int(_) for _ in input().split())

c = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        if (i+j)%k != 0:
            continue
        for a in range(1,n+1):
            if (j+a)%k == 0 and (a+i)%k == 0:
                c += 1
            else:
                continue

print(c)

# Optimized solution
#!/usr/bin/env python3
import sys
import math

def solve(N: int, K: int):

    ans = int(N/K) ** 3

    if(K%2 == 0):
        cnt = 0
        for i in range(int(K/2), N+1, K):
            cnt += 1
        ans += cnt ** 3
    
    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()
# Original solution
import sys
from collections import deque
from itertools import permutations
input = sys.stdin.readline

N, K = [int(x) for x in input().strip().split()]
l1 = deque([])
l2 = deque([])
ans = deque([])
c = K
while c <= N:
    l1.append(c)
    c += K
for i in l1:
    for j in l1:
        for k in l1:
            ans.append((i, j, k))

if K % 2 == 0:
    c = K / 2
    while c <= N:
        l2.append(c)
        c += K
    for i in l2:
        for j in l2:
            for k in l2:
                ans.append((i, j, k))

print((len(list(set(ans)))))

# Optimized solution
import sys
from collections import deque
from itertools import permutations
input = sys.stdin.readline

N, K = [int(x) for x in input().strip().split()]
l1 = deque([])
l2 = deque([])
ans = deque([])
c = K

while c <= N:
    l1.append(c)
    c += K
ans = len(l1) ** 3

if K % 2 == 0:
    c = K / 2
    while c <= N:
        l2.append(c)
        c += K
ans += len(l2) ** 3

print(ans)
# Original solution
N,K = (int(i) for i in input().split())


MAX = int(2*N/K+1)

ans1=0
ans2=0
ans3=0

for alpha in range(1,MAX):
    for beta in range(alpha,MAX):
        for gamma in range(beta,MAX):
            a = K*(alpha-beta+gamma)
            b = K*(alpha+beta-gamma)
            c = K*(-alpha+beta+gamma)
            if(all([a>0,b>0,c>0]) and
            all([a<=N*2,b<=N*2,c<=N*2]) and
            all([a%2==0,b%2==0,c%2==0])
            ):
                if a==b and b==c:
                    ans1+=1
                elif a==b or b==c or c==a:
                    ans2+=1
                else:
                    ans3+=1

print((ans1+ans2*3+ans3*6))

# Optimized solution
N,K = (int(i) for i in input().split())

if K%2==1:
    print(((N//K)**3))
else:
    print(((N//K)**3+((N-K//2)//K+1)**3))
# Original solution
N, K = list(map(int, input().split()))

v = 0
t = (2*N) // K

for i in range(1,t+1):
    if (K*i) % 2 == 0:
        if i % 2 == 1:
            for j in range(1,t+1,2):
                if (K*j) % 2 == 0:
                    for k in range(1,t+1,2):
                        if (K*k) % 2 == 0:
                            v += 1
        else:
            for j in range(2,t+1,2):
                if (K*j) % 2 == 0:
                    for k in range(2,t+1,2):
                        if (K*k) % 2 == 0:
                            v += 1
print(v)

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

v = 0
t = (2*N) // K
s = N // K

if K % 2 == 0:
    if t % 2 == 0:
        v = 2*((t/2)**3)
    else:
        v = (((t+1)/2)**3) + (((t-1)/2)**3)
else:
    v = s**3

v = int(v)
print(v)
# Original solution
N, K = list(map(int, input().split()))

num = [0] * K
for i in range(1, N + 1):
    num[i % K] += 1

res = 0
for a in range(K):
    b = (K - a) % K
    c = (K - a) % K
    if (b + c) % K == 0:
        res += num[a] * num[b] * num[c]
print(res)

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

x = N // K
ans = x ** 3
if K % 2 == 0:
    y = (N + (K // 2)) // K
    ans += y ** 3
print(ans)
# Original solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=list(map(int,input().split()))
    if(k&1):
        s=n//k
        print((s**3))
    else:
        s=n//k
        t=(n//(k//2)+1)//2
        print((s**3+t**3))
resolve()

# Optimized solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=list(map(int,input().split()))
    if(k&1):
        s=n//k
        print((s**3))
    else:
        s=n//k
        t=(n+k//2)//k
        print((s**3+t**3))
resolve()
# Original solution
import itertools

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

comb = []
if K % 2 != 0:
    tail = N//K+1
    for a in range(1, tail):
        for b in range(1, tail):
            for c in range(1, tail):
                # print('odd:', a*K, b*K, c*K)
                comb.append((a, b, c))
else:
    tail = N//K+1
    for a in range(1, tail):
        for b in range(1, tail):
            for c in range(1, tail):
                # print('even_1:', a*K, b*K, c*K)
                comb.append((a, K, b, K, c, K))
    tail = (2*N+K)//(2*K)+1
    for a in range(1, tail):
        for b in range(1, tail):
            for c in range(1, tail):
                # print('even_2:', a*K-K//2, b*K-K//2, c*K-K//2)
                comb.append((a, K, 1, b, K, 1, c, K, 1))


print((len(set(comb))))


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

if K % 2 == 0:
    ans = (N//K)**3 + ((N+K//2)//K)**3
else:
    ans = (N//K)**3
print(ans)
# Original solution
N,K=list(map(int,input().split()))
ans=0
for h in range(2//K,(2*N//K)+1):
    if h*K%2==1:
        continue
    a=h*K//2
    if 1<=a<=N:
        for i in range((1+a)//K,(N+a)//K+1):
            b=i*K-a
            if 1<=b<=N:
                for j in range((1+b)//K,(N+b)//K+1):
                    c=j*K-b
                    if 1<=c<=N and (c+a)%K==0:
                            ans+=1
print(ans)


# Optimized solution
N,K=list(map(int,input().split()))
if K%2==1:
    print(((N//K)**3))
else:
    print(((N//K)**3+(2*N//K-N//K)**3))