CodeEff/ECCO huggingface dataset:
# Original solution
N, K = list(map(int, input().split()))

ans = 0
for a in range(1, N+1):
    cnt = 0
    tmp = K - a % K
    if tmp > N:
        continue
    for b in range(tmp, N+1, K):
        if K - b % K != tmp:
            continue
        for c in range(tmp, N+1, K):
            cnt += 1
    ans += cnt

print(ans)


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

ans = (N // K) ** 3

if K % 2 == 0:
    ans += ((N + K//2) //K) ** 3

print(ans)
# Original solution
import itertools
n, k = list(map(int, input().split()))
cnt = 0
for i in itertools.combinations_with_replacement(list(range(1, n + 1)), 3):
    if (i[0] + i[1]) % k == 0 and (i[1] + i[2]) % k == 0 and (i[2] + i[0]) % k == 0:
        cnt += len(list(set((itertools.permutations(i)))))
print(cnt)

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

s = n // k
ans = s ** 3
if k % 2 == 0:
    s_ = (n + (k // 2)) // k
    ans += s_ ** 3
print(ans)
# Original solution
from itertools import product

def solve():
  n, k = list(map(int, input().split()))
  count = 0
  # # A解法
  # for a in range(1, n+1):
  #   for b in range(1, n+1):
  #     # for c in range(1, n+1):
  #     count += min(a, cal(a, b, 3, n, k))

  # B解法
  ary = [(a, b, c)
    for a in range(1, n+1)
    for b in range(1, n+1)
    for c in range(1, n+1)]
  # print(ary)

  for i in range(len(ary)):
    A = ary[i][0] + ary[i][1]
    B = ary[i][1] + ary[i][2]
    C = ary[i][0] + ary[i][2]

    if A%k ==0 and B%k ==0 and C%k ==0:
      count += 1


  
  # for a, b, c in ary:
  #   if (a+b)%k == 0 and (b+c)%k == 0 and (c+a)%k == 0:
  #     count += 1

  # C解法
  # a = range(1, n+1)
  # for i in range(1, n+1):
  #   b = i


  
  print(count)


solve()


# Optimized solution
def solve():
  n, k = list(map(int, input().split()))
  
  divList = [0 for _ in range(k)]
  for i in range(1, n+1):
    divList[i % k] += 1
  
  count = 0
  for i in range(k):
    if (i*2) % k ==0:
      count += divList[i] ** 3
  print(count)
solve()
# Original solution
n, k = list(map(int, input().split()))

# num[x]:kで割ってxあまる数が1以上N以下に何個あるか
num = [0 for _ in range(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:
        continue
    res += num[a] * num[b] * num[c]

print(res)


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

if k % 2 != 0:
    x = n // k
    print((x ** 3))
else:
    x = n // k
    y = 0
    for i in range(1, n + 1):
        if i % k == k // 2:
            y += 1
    print((x ** 3 + y ** 3))
# Original solution
import itertools
n,k=list(map(int,input().split()))
aa=k/2
a=[]
b=[]
if k%2==0:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
        elif i%k==aa:
            b.append(i)
else:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
print((len(list(itertools.product(a,repeat=3)))+len(list(itertools.product(b,repeat=3)))))


# Optimized solution
import itertools
n,k=list(map(int,input().split()))
aa=k/2
a=[]
b=[]
if k%2==0:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
        elif i%k==aa:
            b.append(i)
else:
    for i in range(1,n+1):
        if i%k==0:
            a.append(i)
tot=len(set(a))**3+len(set(b))**3
print(tot)
# Original solution
n, k = list(map(int, input().split()))

list = []
p = 0

for a in range(1,n+1):
    x = int(a/k)
    y = int((n+a)/k)
    for i in range(x+1,y+1):
            if  (i*k-a+i*k-a) % k ==0:
                p = p + (y-x)
            else:
                pass

print(p)

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

list = []
p = 0

for a in range(1,n+1):
    x = int(a/k)
    y = int((n+a)/k)
    if  2*a % k ==0:
        p = p + (y-x)**2
    else:
        pass

print(p)
# Original solution
n,k = list(map(int,input().split()))
# print('n,k',n,k)
# print('---')
ans = 0
q,r = divmod(n,k)
# print('q',q,'r',r)
for a in range(1, n+1):
    b = k - a%k
    c = k - b%k
    if (c+a)%k == 0:
        # print(a,b,c)
        now = 1
        if 1 <= b%k <= r: now *= q+1
        else: now *= q
        if 1 <= c%k <= r: now *= q+1
        else: now *= q
        ans += now

# print('ans',ans)
print(ans)


# Optimized solution
n, k = list(map(int,input().split()))
ans = 0
q, r = divmod(n, k)
for a in range(1, n+1):
    b = k - a%k
    c = k - b%k
    if (c + a)%k == 0:
        now = 1
        if 1 <= b%k <= r: now *= q+1
        else: now *= q
        if 1 <= c%k <= r: now *= q+1
        else: now *= q
        ans += now
print(ans)
# Original solution
N,K = list(map(int,input().split()))
flag = 0
a = 1
while a <= N:
  b = 1
  while b <= a:
    c = 1
    while c <= b:
      if (a+b)%K == 0 and (b+c)%K == 0 and (c+a)%K == 0:
        if a == b and b == c:
          flag = flag + 1
        elif a == b or b == c or c == a:
          flag = flag + 3
        else:
          flag = flag + 6
      c = c + 1
    b = b + 1
  a = a + 1
print(flag)

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

a, b = list(map(int, input().split()))
c = []
for i in range(1, a + 1):
    if i % b == 0 or i % b == b / 2:
        c.append(i)
d = 0
for i in itertools.product(c, repeat=3):
    if (i[0] + i[1]) % b == 0 and (i[0] + i[2]) % b == 0 and (i[1] + i[2]) % b == 0:
        d += 1
print(d)


# Optimized solution
a, b = list(map(int, input().split()))
c = []
d = []
for i in range(1, a + 1):
    if i % b == 0:
        c.append(i)
    elif i % b == b / 2:
        d.append(i)
e = 0
print((len(c) * len(c) * len(c) + len(d) * len(d) * len(d)))
# Original solution
n,k=list(map(int,input().split()))
p=0
for a in range(1,n+1):
  for b in range(1,n+1):
    for c in range(1,n+1):
      if (a+b)%k==0 and (b+c)%k==0 and (c+a)%k==0:
        p+=1
print(p)

# Optimized solution
n,k=list(map(int,input().split()))
a=n//k
if k%2==0:
  b=0
  for i in range(1,n+1):
    if i%k==int(k/2):
      b+=1
  print((a**3+b**3))
else:
  print((a**3))
# Original solution
def iin(): return int(eval(input()))
def nl(): return list(map(int, input().split()))
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]

n, k = nl()

d = dict()
for i in range(1, n + 1):
    t = i % k
    d[t] = d.get(t, 0) + 1

ans = 0
if k % 2 == 0:
    ans += d.get(k // 2, 0) ** 3
ans += d.get(0, 0) ** 3
print(ans)

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

ans = 0
if k % 2 == 0:
    ans += ((n - k // 2) // k + 1) ** 3
ans += (n // k) ** 3
print(ans)
# Original solution
import itertools
N,K = list(map(int,input().split()))
count = 0
list_abc = list(itertools.product(list(range(1,N+1)),repeat = 3))
for i in list_abc:
  if (i[0] + i[1])%K==0 and (i[1] + i[2])%K==0 and (i[0] + i[2])%K==0:
    count = count +1
print(count)

# Optimized solution
N,K = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for i in range(1,N+1):
    if i%K == 0:
        ans1 += 1
if K%2 == 0:
    for i in range(1,N+1):
        if i%K == K//2:
            ans2 += 1
print((ans1**3 + ans2**3))
# Original solution
# -*- coding: utf-8 -*-

import itertools

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

p = list(itertools.product(list(range(1,N+1)), repeat=3))

ans = 0
for pair in p:
    if (pair[0] + pair[1]) % K == 0 and (pair[1] + pair[2]) % K == 0 and (pair[2] + pair[0]) % K == 0:
        ans += 1

print(ans)

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

# mod Kをうまく使ってaを全検索

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

num = [0] * K
# 元のNまでの数がmod Kの世界で何になるかを集計
for i in range(1,N+1):
    num[i%K] += 1

ans = 0
# a mod Kを決め打ちしてb mod Kとc mod Kを出す
for a in range(K):
    b = (K - a) % K
    c = (K - a) % K
    # つじつまが合ってるか確認
    if (b + c) % K == 0:
        # 予め集計してあるmod Kでの数を合計させる
        ans += num[a] * num[b] * num[c]
print(ans)
# Original solution
n, k = list(map(int, input().split()))

ans = 0

for a in range(k, n + 1, k):
    for b in range(k, n + 1, k):
        for c in range(k, n + 1, k):
            ans += 1

if k % 2 == 0:
    for a in range(int(k / 2), n + 1, k):
        for b in range(int(k / 2), n + 1, k):
            for c in range(int(k / 2), n + 1, k):
                ans += 1

print(ans)

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

ans = 0
t = 0

for i in range(k, n + 1, k):
    ans += 1

ans **= 3

if k % 2 == 0:
    for j in range(int(k / 2), n + 1, k):
        t += 1
    
    ans += t ** 3

print(ans)
# Original solution
N,K = (int(i) for i in input().split())
ans=0
for a in range(1,N+1):
    for b in range(1,N+1):
        for c in range(1,N+1):
            if (a+b)%K ==0 and (b+c)%K ==0 and (c+a)%K==0:
                ans +=1
print(ans)

# Optimized solution
N,K = (int(i) for i in input().split())
a=0
b=0
if K%2 !=0:
    print(((N//K)**3))
else:
    for i in range (1,N+1):
        if i % K == 0:
            a += 1
        elif i % K == K/2:
            b += 1
    print((a**3+b**3))
# Original solution
from itertools import product

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

# print(len(list(filter(lambda x: 2*x%K==0, range(1, N+1))))**2)
l = []
for i in range(1, N+1):
	if (2*i)%K == 0:
		l.append(i)
count = 0
for a, b, c in product(l, repeat=3):
	if (a+b)%K == (b+c)%K == (c+a)%K == 0:
		count += 1
print(count)

# Optimized solution
from itertools import product

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

"""
i%K == 0 ならその数同士で条件に合う数列を作れる
i%K == K//2 ならその数同士で条件に合う数列を作れる(Kが偶数の場合)
これらは条件によって導ける
"""

count = (N//K)**3
if K%2 == 0:
	count += (N//K + (N%K >= K//2))**3
print(count)
# Original solution
N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
mods = [div + (0 < i <= rem) for i in range(K)]
total = mods[0] ** 3
if not K & 1:
    total += mods[K >> 1] ** 3
print(total)

# Optimized solution
N, K = list(map(int, input().split()))
div, rem = divmod(N, K)
total = div ** 3
if not K & 1:
    total += (div + (0 < K <= (rem << 1))) ** 3
print(total)
# Original solution
import itertools

N,K = list(map(int,input().split()))
a=[]
b=[]
ans = 0
for i in range(1,N+1):
    a.append(i)
b += itertools.product(a,repeat = 3)

for i in b:
    #print(i[0],i[1],i[2])
    if (i[0]+i[1])%K==0 and (i[1]+i[2])%K==0 and (i[0]+i[2])%K==0:
        ans+=1
#print(a)
#print(b)
print(ans)

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

if K%2==0:
    d1=N//(K//2)
    d2=N//K
    ans=d2**3+(d1-d2)**3
else:
    d=N//K
    ans = d**3

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

cnt = 0
for a in range(1,n+1):
    if (2*a) % k == 0:
        for b in range(a,n+1):
            if ((2*b) % k == 0)and((a+b) % k == 0 )and((a-b) % k == 0 ):
                for c in range(b,n+1):
                    if ((2*c) % k == 0)and((a+c) % k == 0 )and((c+b) % k == 0 ):
                        if (a==b)and(b==c):
                            cnt += 1
                        elif (a!=b)and(b!=c)and(a!=c):
                            cnt += 6
                        else:
                            cnt +=3
                        
                        

print(cnt)


# Optimized solution
#!/usr/bin/env python3
import sys
 
 
def solve(N: int, K: int):
    count = 0
 
    if K % 2 == 0:
        count += (N//K)**3
        # a,b,c == 0 mod K//2
        count += (N//(K//2) - N//K)**3
    else:
        count += (N//K)**3
    print(count)
    return
 
 
def main():
    N,K= list(map(int,input().split()))
    # N = int(next(tokens))  # type: int
    # K = int(next(tokens))  # type: int
    solve(N, K)
 
 
if __name__ == '__main__':
    main()
# Original solution
import itertools
n, k = list(map(int, input().split()))
a = []
x = k/2
count = 0
while x <= n:
    if x % 1 == 0:
        a.append(int(x))
    x += k/2
ori_list = list(itertools.product(a, repeat=3))
for i in range(len(ori_list)):
    if (ori_list[i][0] + ori_list[i][1]) % k == 0:
    	if (ori_list[i][1] + ori_list[i][2]) % k == 0:
    		if (ori_list[i][0] + ori_list[i][2]) % k == 0:
        		count += 1

print(count)

# Optimized solution
n, k = list(map(int, input().split()))
cnt = 0

if k % 2 == 1:
    for i in range(1, n+1):
        if i % k == 0:
            cnt += 1
    ans = cnt ** 3
elif k % 2 == 0:
    cnt1 = 0
    cnt2 = 0
    for i in range(1, n+1):
        if i % k == 0:
            cnt1 += 1
        elif i % k == k/2:
            cnt2 += 1
    ans = cnt1 ** 3 + cnt2 ** 3
print(ans)
# Original solution
ans = []
inp = [int(x) for x in input().split()]

n = inp[0]
k = inp[1]

for a in range(1, n+1):
    for b in range(1, n+1):
        for c in range(1, n+1):
            if (a+b) % k == 0 and (b+c) % k == 0 and (c+a) % k == 0:
                ans.append([a, b, c])

print((len(ans)))

# Optimized solution
inp = [int(x) for x in input().split()]
n = inp[0]
k = inp[1]

num = [x for x in range(0, n+1, k)]
ans = (len(num)-1) ** 3

if k % 2 == 0:
    c = 0
    for i in range(1, n+1):
        if i % k == k / 2:
             c += 1
    ans += c ** 3
    

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

for i in range(1, N+1):
    j = K - i
    while j <= 0:
        j += K
    while j <= N:
        k = K - i
        while k <= 0:
            k += K
        while k <= N:
            if (j+k) % K == 0 and (j+k) != 0:
                counter += 1
            k += K
        j += K

print(counter)


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

print(result)
# Original solution
from itertools import combinations_with_replacement

N,K = list(map(int,input().split()))
ans = 0
for cmb in combinations_with_replacement([i for i in range(1,N+1)],3):
  if all([True if a%K ==0 else False for a in [cmb[0]+cmb[1], cmb[1]+cmb[2],cmb[2]+cmb[0]]]):
    set_num = len(set(cmb))
    if set_num == 1: ans += 1
    elif set_num == 2: ans += 3
    elif set_num == 3: ans += 6
  #print(ans, cmb)
print(ans)

# Optimized solution
from itertools import combinations_with_replacement

def calc_cases(num):
  cases = num
  if num == 2: cases += num*(num-1)*3
  elif num >= 3: cases += num*(num-1)*3 + num*(num-1)*(num-2)
  return int(cases)

N,K = list(map(int,input().split()))
num, num2 = 0, 0
if K%2 ==1:
  for i in range(1,N+1):
    if i%K == 0: num +=1
else:
  for i in range(1,N+1):
    if i%K == 0:
      num +=1
    elif i%K == K//2:
      num2 += 1

print((calc_cases(num)+calc_cases(num2)))
#print(num, calc_cases(num), num2, calc_cases(num2))
# Original solution
N, K = list(map(int, input().split()))

A = []
for i in range(2, 2*N+1):
    if i%K == 0:
        A.append(i)

ans = 0
for x in range(len(A)):
    for y in range(len(A)):
        for z in range(len(A)):
            a = (A[x]-A[y]+A[z])/2
            if int(a) == a and 1 <= a <= N and 1 <= A[x]-a <= N and 1 <= A[z]-a <= N:
                ans += 1

print(ans)

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

if K%2 == 1:
    print(((N//K)**3))
else:
    a, b = 0, 0
    for i in range(1, N+1):
        if i%K == 0:
            a += 1
        elif i%K == K//2:
            b += 1
    print((b**3+a**3))
# Original solution
n,k=list(map(int,input().split()))

t=0
v=2*n//k

for apb in range(k,k*(v+1),k):
  for bpc in range(k,k*(v+1),k):
    for cpa in range(k,apb+bpc,k):
      if (apb+bpc+cpa)%2:
        continue
      a = (apb+bpc+cpa - 2*bpc)//2
      b = (apb+bpc+cpa - 2*cpa)//2
      c = (apb+bpc+cpa - 2*apb)//2
      if 0 < a and a <= n and 0 < b and b<=n and 0 < c and c <= n:
        t += 1

print(t)



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

x = n//k
y = x if k%2 else n//(k//2)

print((x**3+(y-x)**3))
# Original solution
import sys
input = sys.stdin.readline

N,K = list(map(int,input().split()))
target =[]
i=3
x = i/2*K
while x <= 3*N:
    if x == int(x):
        target.append(int(x))
    i += 1
    x = i/2*K
count = 0
if K%2 == 0:
    A = list(range(K//2,N+1,K//2))
else:
    A = list(range(K,N+1,K))


for trg in target:
    for a in A:
        for b in range((a//K+1)*K-a,N+1,K):
            c = trg - a - b
            #print(a,b,c,target)
            if  0 < c <= N  and (b+c)%K == 0 and (c+a)%K ==0:
                #print(a,b,c)
                count += 1
print(count)


# Optimized solution
import sys
input = sys.stdin.readline
N,K=list(map(int,input().split()))
if K%2 == 0:
    A = list(range(K//2,N+1,K))
    B = list(range(K,N+1,K))
else:
    A = list(range(K,N+1,K))
    B = []
print((len(A)**3+len(B)**3))
# Original solution
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count1 = count2 = 0

n,k=list(map(int,input().split()))
count1+=n//k
if k%2==0:count2+=(n+k//2)//k
# for ii in itertools.product(range(1,n//k+2), repeat=3):
#     print(ii)
# print(count)
a=len(list(itertools.product(list(range(count1)),repeat=3)))
b=len(list(itertools.product(list(range(count2)),repeat=3)))
print((a+b))


# Optimized solution
ans = count1 = count2 = 0
n,k=list(map(int,input().split()))
count1+=n//k
if k%2==0:count2+=(n+k//2)//k
print((count1**3+count2**3))
# Original solution
# encoding: utf-8
N, K = list(map(int, input().split()))

ans = 0

# 2 * (a + b + c) = K * (p + q + r)
for pqr in range(3, (6 * N) // K + 1):
    # a + b + c = ?
    if (pqr * K) % 2: continue
    else: abc = (pqr * K) // 2
    for p in range(max((1, -((N - abc) // K))), abc // K + 1):
        qr = pqr - p
        min_r = -((p * K - 2 * abc) // (2 * K))
        max_r = min(((2 * abc) // K - 2 * p, (abc - 1) // K))
        # count w/o r loop
        if min_r > max_r: continue
        # print(abc, (p, qr - min_r, min_r), (p, qr - max_r, max_r))
        ans += (max_r - min_r + 1) * 6
        if p == qr - min_r == min_r: ans -= 5 # p = q = r
        if p < qr - min_r == min_r: ans -= 3 # p < q = r
        if p == qr - max_r < max_r: ans -= 3 # p = q < r
            
    
print(ans)


# Optimized solution
# encoding: utf-8
N, K = list(map(int, input().split()))

ans = 0
for a in range(1, N + 1):
    # find a (a, b, c)
    # maybe TLE
    # for b in range(1, N + 1):
    #     if (a + b) % K == 0: break
    # for c in range(1, K + 1):
    #     # c and c + K returns same result
    #     if (b + c) % K == 0 and (a + c) % K == 0: break
    #     else: continue
    # else:
    #     continue # next a
    if (K - 2 * a) % K: continue
    b = K - (a % K)
    c = K - b            
    # b_min, c_min
    b_min = K - (K - b) % K
    c_min = K - (K - c) % K
    # b_max, c_max
    b_max = N - (N - b_min) % K
    c_max = N - (N - c_min) % K
    # add
    # print(a, b, c, (b_min, b_max), (c_min, c_max))
    ans += ((b_max - b_min) // K + 1) * ((c_max - c_min) // K + 1)

print(ans)
# Original solution
N,K = list(map(int,input().split()))
ans = 0
for a in range(1,N+1):
    for b in range(1,N+1):
        for c in range(1,N+1):
            if ((a+b) % K == 0) and ((a+c) % K == 0) and ((b+c) % K == 0):
                ans += 1
            else:
                continue
print(ans)

# Optimized solution
N,K = list(map(int,input().split()))
if K % 2 != 0:
    case1 = len([n for n in range(1,N+1) if n % K ==0])
    print((case1 ** 3))
else:
    case1 = len([n for n in range(1,N+1) if n % K ==0])
    case2 = len([n for n in range(1,N+1) if n % K == K //2])
    print((case1**3 + case2**3))
# Original solution
N, K = list(map(int, input().split()))

if K % 2 == 0:
    c1 = 0
    c2 = 0
    for i in range(1, N+1):
        if i % K == K//2:
            c2 += 1
        if i % K == 0:
            c1 += 1
    print((c1**3+c2**3))
else:
    c = 0
    for i in range(1, N+1):
        if i % K == 0:
            c += 1
    print((c**3))
    

# Optimized solution
N, K = list(map(int, input().split()))
c1 = N // K
if K % 2 == 1:
    print((c1**3))
else:
    c2 = (N+K//2)//K
    print((c1**3+c2**3))
# Original solution
N , K = (int(i) for i in input().split())
a = 0
b = 0
c = 0
count = 0
for i in range(N):
    a = i+1
    for j in range(N):
        b = j + 1
        for k in range(N):
            c = k + 1
            if (a+b)%K==0 and (b+c)%K==0 and (c+a)%K==0:
                count += 1
print(count)

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

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


for i in range(n):
    a = k * (i+1)
    if a <= n:
        for ii in range(n):
            b = k * (ii+1)
            if b <= n:
                for iii in range(n):
                    c = k * (iii+1)
                    if c <= n:
                        ans = ans + 1
                        #print(a,b,c)
                    else:
                        break
            else:
                break
    else:
        break


if k % 2 == 0:
    for j in range(n):
        a = int(k/2) + k * j
        if a <= n:
            for jj in range(n):
                b = int(k/2) + k * jj
                if b <= n:
                    for jjj in range(n):
                        c = int(k/2) + k * jjj
                        if c <= n:
                            ans = ans + 1
                            #print(a,b,c)
                        else:
                            break
                else:
                    break
        else:
            break

print(ans)


# Optimized solution
n,k = list(map(int,input().split()))
ans = 0

if k % 2 != 0:
    print(((n//k)**3))
else:
    print(((n//k)**3+((n+int(k/2))//k)**3))
# Original solution
n,k = list(map(int,input().split()))
a = 0
b = 0
for i in range(1,n+1):
    if i%k==0:
        a += 1
    elif k%2==0 and i%k==k//2:
        b += 1
if k%2==0:
    print((a**3+b**3))
else:
    print((a**3))


# Optimized solution
n,k=list(map(int,input().split()));print(((n//k)**3+(k+1)%2*((n-k//2)//k+1)**3))
# Original solution

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))
    

# Optimized solution

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()
# Original solution
n,k=list(map(int,input().split()))
count=0
if k%2==1:
  print(((n//k)**3))
else:
  for i in range(k//2,n+1,k//2):
    for j in range(k//2,n+1,k//2):
      for l in range(k//2,n+1,k//2):
        if (i+j)%k==0 and (j+l)%k==0 and (l+i)%k==0:
          count+=1
  print(count)

# Optimized solution
n,k=list(map(int,input().split()))
if k%2==1:
  print(((n//k)**3))
else:
  print(((n//k)**3+(n//(k//2)-n//k)**3))
# Original solution
import itertools
N, K = list(map(int, input().split()))
count = 0
poss = [n for n in range(1, N+1) if (2*n)%K==0]

poss2 = list(itertools.product(poss, repeat=3))

count = len([comb for comb in poss2 if (comb[0]+comb[1])%K==0 and (comb[1]+comb[2])%K==0])
print(count)

# Optimized solution
N, K = list(map(int, input().split()))
num = {i%K:N//K for i in range(1, K+1)}
mod = N % K
for i in range(1, mod+1):
    num[i] += 1

ans = 0
for i in range(K):
    if (2*i) % K == 0:
        cnt = num[i]
        cnt *= num[(K-i)%K] * num[(K-i)%K]
        ans += cnt
print(ans)
# Original solution

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

cc=  collections.Counter()
for ii in range(1, n+1):
	cc[ii % k] +=1

r = 0
for ii in cc:
	if 2*(k - ii) % k == 0:
		r += cc[ii] * ((cc[(k - ii) % k ]) ** 2) 
		#* cc[(k - ii) % k] 
print(r)

# Optimized solution
import collections 
n,k = list(map(int, input().split(' ')))

cc=  collections.Counter()
for ii in range(1, n+1):
	cc[ii % k] +=1

r = 0
for ii in cc:
	if (- 2*ii) % k == 0:
		r += cc[ii] * ((cc[(k - ii) % k ]) ** 2) 
		#* cc[(k - ii) % k] 
print(r)