You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.
The order of a,b,c does matter, and some of them can be the same.

-----Constraints-----
 - 1 \leq N,K \leq 2\times 10^5
 - N and K are integers.

-----Input-----
Input is given from Standard Input in the following format:
N K

-----Output-----
Print the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.

-----Sample Input-----
3 2

-----Sample Output-----
9

(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.

Difficulty: introductory

Starter code:

Solutions:
n,k = map(int,input().split())

cnt1,cnt2 = 0,0
if k%2 == 1:
    for i in range(1,n+1):
        if i%k == 0:
            cnt1 +=1
    print(cnt1**3)
else:
    for i in range(1,n+1):
        if  i%k == k//2:
            cnt2 += 1
    for i in range(1,n+1):
        if i%k == 0:
            cnt1 +=1
    print(cnt1**3+cnt2**3)

N,K = (int(T) for T in input().split())
Reminder = [0]*K
for NT in range(1,N+1):
    Reminder[NT%K] += 1
Count = 0
for RA in range(0,K):
    RB = (K-RA)%K
    RC = (K-RA)%K
    if (RB+RC)%K==0:
        Count += Reminder[RA]*Reminder[RB]*Reminder[RC]
print(Count)

n,k=list(map(int,input().split()))
ans=0
if k%2!=0:
    ans=(n//k)**3
else:
    ans=(n//k)**3+((n+k//2)//k)**3
print(ans)


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

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

s = 0

if k % 2 == 1:
    s = (n // k) ** 3
else:
    s = (n // k) ** 3 + ((n // (k // 2)) - (n // k)) ** 3

print(s)

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


import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def Main():
    n, k = read_ints()
    if k % 2:
        print((n // k)** 3)
    else:
        print((n // k)** 3 + ((n + k // 2) // k)** 3)     

def __starting_point():
    Main()
__starting_point()

# -*- coding: utf-8 -*-
"""
Created on Mon Oct  5 21:22:55 2020

@author: liang
"""

N, K = map(int,input().split())
if K % 2 == 0:
    ans = (N//K)**3 + ((N+K//2)//K)**3
    print(ans)
else:
    print((N//K)**3)

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, K = LI()

    # abc全てK//2か全て0のどちらか
    num_0 = N // K
    if K % 2 == 0:
        num_K_half = N // K + (1 if N % K >= K // 2 else 0)
    else:
        num_K_half = 0

    ans = num_0 ** 3 + num_K_half ** 3
    print(ans)

def __starting_point():
    resolve()

__starting_point()

n,k=list(map(int,input().split()))
if k%2==1:
    print((int(n//k)**3))
else:
    s=k//2
    print((int((n+s)//(2*s))**3+int(n//k)**3))
    


def readinput():
    n,k=list(map(int,input().split()))
    return n,k

def main(n,k):
    # a,b,cがkの倍数の場合
    m = n//k
    count=m*m*m
    # kが偶数のとき
    # a,b,cがkの倍数+k/2の場合
    if k%2==0:
        m=(n+k//2)//k
        count+=m*m*m
    return count

def __starting_point():
    n,k=readinput()
    ans=main(n,k)
    print(ans)

__starting_point()

n,k=map(int,input().split())
ans=0
if k>2*n:
  print(ans)
else:
  r=k
  for i in range(1,k):
    if 2*i%k==0:
      r=i
  amari=set()
  for i in range(1,(n-r)//r+1+1):
    if r*i%k in amari:
      continue
    else:
      amari.add(r*i%k)
      q=(n-r*i)//k+1
      ans+=q**3
  print(ans)

n,k=list(map(int,input().split()))
am_0=[]
am_k2=[]

if k%2==0:
  for i in range(1,n+1):
    if i%k==0:
      am_0.append(i)
    
    elif i%k==(k//2):
      am_k2.append(i)
  print((len(am_0)**3+len(am_k2)**3))
  
else:
  print((pow((n//k),3)))


#!/usr/bin/env python

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

# aは全探索
ans = 0 
for a in range(1, n+1):
    ra = a%k 
    rbc = k-ra
    if (2*rbc) % k == 0:
        ans += ((n-rbc)//k + 1)**2

print(ans)


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

if k % 2 == 1:
    print((n//k) ** 3)
else:
    print((((n + k//2)//k)**3) + ((n//k)**3))

a,b=list(map(int, input().split()))
if b%2==1:
    print(((a//b)**3))
else:
    c=(a-b/2)//b+1
    print((int((a//b)**3+c**3)))


import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = list(map(int, readline().split()))

    ans = pow(N // K, 3)
    if K % 2 == 0 and N >= K // 2:
        ans += pow((N - K // 2) // K + 1, 3)

    print(ans)
    return


def __starting_point():
    main()

__starting_point()

from collections import Counter

import numpy as np

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

mods = np.arange(1, N + 1) % K
counter = Counter(mods)

ans = 0
for a in list(counter.keys()):
    if (a + a) % K == 0:
        ans += counter[a] ** 3

print(ans)


n, k = map(int, input().split())
ans = (n // k) ** 3
if k % 2 == 0:
    ans += ((n + k // 2) // k) ** 3
print(ans)

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

if k%2==1:
    print((n//k)**3)
else:
    print((n // k)**3+(n // k+(n%k)//(k//2))**3)

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

if K % 2 == 1:
    print((N // K) ** 3)
else:
    a = N // K
    t = K // 2
    b = (N - t) // K + 1
    print(a ** 3 + b ** 3)

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n,k = i_map()

    R = [0]*k
    for i in range(1,n+1):
        R[i%k] += 1

    ans = 0
    for a in range(k):
        b = (k-a)%k
        if 2*b%k == 0: # b==cとしてbを2倍
            ans += R[a] * R[b] * R[b]

    print(ans)

def __starting_point():
    main()

__starting_point()

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

res = (N // K) ** 3

if K % 2 == 0:
    res += ((N - K // 2) // K + 1) ** 3

print(res)

n,k = map(int,input().split())
if k%2 == 1:
    ans = (n//k)**3
else:
    if k <= 2*n:
        a = (n//(k//2))
        b = a//2
        ans = (a-b)**3 + b**3
    else:
        ans = 0
print(ans)

N,K=map(int,input().split())
ans=0
if K%2==1:
  print((N//K)**3)
else:
  ans=(N//K)**3
  k=K//2
  j=(N+k)//K
  print(j**3+ans)

n, k = map(int, input().split())
candidOdd = 0
candidEven = 0
candidEven2 = 0
for i in range(1, n+1):
    if k % 2 == 1:
        if i % k == 0:
            candidOdd += 1
    else:
        if i % k == 0:
            candidEven += 1
        elif i % k == (k/2):
            candidEven2 += 1
print(candidOdd**3 + candidEven**3 + candidEven2**3)

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

if K % 2 == 1:
    print((N // K) ** 3)
else:
    print((N // K) ** 3 + ((N + K // 2) // K) ** 3)

import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,k = inpm()

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

print(ans)

n, k = map(int, input().split())
ans = 0

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

print(ans)

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    if K % 2 == 1:
        a = N // K
        print((a * a * a))
        return
    else:
        a = N // K
        count = a * a * a
        b = (N+K//2)//K
        count+=b*b*b
        print(count)



def __starting_point():
    main()

__starting_point()

#!/usr/bin/env python3

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

ans = 0

num_multiple = n//k

ans += num_multiple**3

if k % 2 == 0:
    num_multiple = (n+k//2)//k
    ans += num_multiple**3
print(ans)


N,K=map(int,input().split())
if K%2==1:
  print((N//K)**3)
  return
k=K//2
t=N//k-N//K
print(t**3+(N//K)**3)

n,k = map(int,input().split())
if k % 2 == 1:
    ans = (n // k) ** 3
if k % 2 == 0:
    mk2 = n // (k //2)
    mk = n // k
    ans = mk ** 3 + (mk2 - mk) ** 3
print(ans)

n,k = map(int,input().split())
cnt1 = 0
cnt2 = 0
for i in range(1,n+1):
    if i%k == 0: cnt1 += 1
    if i%k == k//2: cnt2 += 1
ans = cnt1**3 if k%2 == 1 else cnt1**3+cnt2**3
print(ans)     

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


n,k= list(map(int,input().split()))
count_0 = 0
count_half = 0
for i in range(1,n+1):
    if i %k == k/2:
        count_half += 1
    elif i%k == 0:
        count_0 += 1
        
print(count_half**3 + count_0**3)

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


kcd=0
kcd_half=0
for i in range(1,n+1):
    if k&1 and i%k==0:
        kcd+=1
    elif not k&1:
        if i%k==0:
            kcd+=1
        if i%k==k//2:
            kcd_half+=1

print((kcd*kcd*kcd+kcd_half*kcd_half*kcd_half))


N , K = map(int, input().split())
ans = 0
if K%2==0:
  ans += (N//K)**3
  ans += (N//(K//2)-N//K)**3
else:
  ans += (N//K)**3
print(ans)

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

# 1以上N以下で、Kで割った余りが0,1,...,K-1となる個数
l = [0] * K
for i in range(1, N + 1):
    l[i % K] += 1

ans = 0

# aをKで割った余りは0,1,...,K-1
for ai in range(K):
    # bをKで割った余り...(a+b)%K==0から   cをKで割った余り...(a+c)%K==0から
    # ai = 0の時にK-aiがKとなって「余り」として不適なので%をかける
    bi = (K - ai) % K
    ci = (K - ai) % K
    # (b+c)%K==0を満たせば良い
    if (bi + ci) % K == 0:
        ans += l[ai] * l[bi] * l[ci]
print(ans)


n, k = map(int, input().split())
mod_0 = 0
mod_harf = 0

for i in range(1, n + 1):
    if i % k == 0:
        mod_0 += 1
    elif i % k == (-i) % k:
        mod_harf += 1

res = mod_0 ** 3 + mod_harf ** 3
print(res)

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

num = [0] * K

for i in range(1, N + 1):
    num[i % K] += 1  # num[x] = Kで割ってx余る数が1以上N以下に何個あるか
ans = 0
for a in range(K):

    b = (K - a) % K
    c = (K - a) % K
    if (b + c) % K != 0:
        continue
    ans += num[a] * num[b] * num[c]
print(ans)


N, K = map(int, input().split())
ans = 0
for r in range(K):
    n = (N + K - r) // K
    if r == 0:
        n -= 1
    if r * 2 % K == 0:
        ans += n ** 3
print(ans)

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


if (K%2!=0):
    ans=(N//K)**3
else:
    k=N//K
    k_=N//(K//2)
    ans=k**3+(k_-k)**3

print(ans)


import itertools
ans = 0
N, K = [int(i) for i in input().split()]
x = 0
y = 0
for i in range(1, N+1):
    if i % K == 0:
        x += 1
    if K % 2 == 0 and i % K == (K//2):
        y += 1
print((x**3 + y**3))


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

if k ==1:
    print(n**3)

elif k ==2:
    m = n % 2
    o = n//2
    print((o+m)**3+o**3)

elif k % 2==1:
    x = n//k
    print(x**3)

else:
    x = n//k
    y = n//(k//2)
    print(x**3+(y-x)**3)

n,k = map(int,input().split())
ans = 0
if k%2 == 0:
    ans += ((n+k//2)//k)**3
ans += (n//k)**3
print(ans)

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

if k % 2 == 1:
    x = 0
    for i in range(1,n+1):
        if i % k == 0:
            x += 1
    print(x**3)
else:
    x = 0
    for i in range(1,n+1):
        if i % k == 0:
            x += 1
    y = 0
    for i in range(1,n+1):
        if i % k == k//2:
            y += 1
    print(x**3 + y**3)

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

"""
a+b = K i
b+c = K j
c+a = K k
2(a+b+c) = K(i+j+k)

k%2=0ならば,
a+b+cはk//2の倍数でなければならない、かつ、差を取ると結局a,b,cがそれぞれk//2の倍数
でなければならい。それでa+b,b+c,c+dはｋの倍数だから、a,b,cはすべて偶数またはすべて奇数
でなければならない。

それ以外の場合、
a+b+cがkの倍数である必要があり、かつ差を取ると結局a,b,cがすべてkの倍数でなければ
ならない。
"""

if k%2==0:
    k//=2
    a = n//k
    even = a//2
    if a%2==0:
        odd = even
    else:
        odd = even+1
    ans = even**3 + odd**3
else:
    ans = (n//k)**3
print(ans)



N,K = list(map(int,input().split()))
modZeroCount = N // K
modHalfCount = 0
if K % 2 == 0:
    modHalf = K // 2
    if N % K < modHalf:
        modHalfCount = modZeroCount
    else:
        modHalfCount = modZeroCount + 1
answer = modZeroCount ** 3 + modHalfCount ** 3
print(answer)

n, k = list(map(int, input().split()))
ans = (n // k) ** 3
if k % 2 == 0:
    ans += ((n + k // 2) // k) ** 3
print(ans)


def main():
    n,k = list(map(int,input().split()))
    if k%2==1:
        c = n//k
        print((c**3))
        return
    if k%2==0:
        c = (n-k//2)//k+1
        ans = c**3
        c = n//k
        print((ans + c**3))

def __starting_point():
    main()

__starting_point()

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

am = [0]*k
for i in range(1, n+1):
  res = i%k
  if (res+res)%k==0:
    am[res]+=1

#print(am)

ans = 0
for i in am:
  ans += i**3 
  
print(ans)

n,k = map(int,input().split())
if k%2==0:
    print(((n-k//2)//k+1)**3+(n//k)**3)
else:
    print((n//k)**3)

def main():
    n,k = list(map(int,input().split()))
    ans = 0
    if k%2==0:
        kouho1 = []
        kouho2 = []
        for i in range(1,n+1):
            if i%k==0:
                kouho1.append(i)
            elif i%k == k/2:
                kouho2.append(i)
        ans += len(kouho1)**3
        ans+= len(kouho2)**3
    else:
        kouho = []
        for i in range(1,n+1):
            if i%k==0:
                kouho.append(i)
        ans += len(kouho)**3

    print(ans)
main()


n,k = map(int,input().split())
j=0
m=0
ans = 0
if k % 2 == 1:
    j= n//k
    #print('j',j)
    ans=j*j*j

else:
    j=n//k
    m=(n-k//2)//k+1
    #print('j',j,'m',m)
    ans=m*m*m+j*j*j
 
print(ans)

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

if k%2 == 1: # kが奇数の場合
  x = 0
  for i in range(1,n+1):
    if i%k == 0: x += 1 # kで割り切れる値の数をカウント
  print(x**3) # 組み合わせ分増える
else: # kが偶数の場合
  x = 0
  for i in range(1, n+1):
    if i % k == 0: x += 1 # kで割り切れる値の数をカウント
  y = 0
  for i in range(1, n+1):
    if i % k == k//2: y += 1 # k//2で割り切れる値の数をカウント
  print(x**3 + y**3) # 組み合わせ分増える

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

if K % 2 != 0:
    print(((N//K) ** 3))
else:
    print(((N//K) ** 3 + ((N//(K//2))-(N//K)) ** 3))


N,K = map(int,input().split())
s = N//K
t = N%K
ans = s**3
if K%2 == 0:
    u = K//2
    if t < u:
        ans += s**3
    else:
        ans += (s+1)**3
print(ans)

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

s=[]
for i in range(1,n+1):
  s.append(i%k)

from collections import Counter
dic=Counter(s)

ans=0
for a in dic:
  if (2*a)%k==0:
    ans=ans+dic[a]*dic[(k-a)%k]*dic[(k-a)%k]
    
print(ans)

  
  



def main():
  N, K = [int(n) for n in input().split(" ")]

  mul_K = int(N/K)

  if K % 2 == 1:
    print(mul_K ** 3)
    return 0
  
  mul_K_half = int(2 * N/K)
  mul_K_half_but_K = mul_K_half - mul_K
  print(mul_K ** 3 + mul_K_half_but_K ** 3)
  return 0

main()

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)

n,k = map(int,input().split())
if k > 2:
    if k % 2 == 0:
        a = n//(k//2)
        if a % 2 == 0:
            print(2*((a//2)**3))
        else:
            print(((a//2)**3)+(((a//2)+1)**3))
    else:
        print((n//k)**3)
elif k == 2:
    if n % 2 == 0:
        print(2*((n//2)**3))
    else:
        print(((n//2)**3)+(((n//2)+1)**3))
else:
    print(n**3)

n,k=map(int,input().split())
if k%2==0:
    print(int(n/k)**3+(int((n-k/2)/k+1)**3))
else:
    print(int(n/k)**3)

N,K = map(int,input().split())
s = N//K
t = N%K
ans = s**3
if K%2 == 0:
    u = K//2
    if t < u:
        ans += s**3
    else:
        ans += (s+1)**3
print(ans)

N, K = map(int,input().split())
if K % 2 == 1:
    c = N//K
    ans = c*(c-1)*(c-2)+3*c*(c-1)+c
    print(ans)
else:
    K //= 2
    e = 0
    o = 0
    for i in range(1, N+1):
        if i % K == 0:
            if (i//K) % 2 == 0:
                e += 1
            else:
                o += 1
    c = e
    ans = c*(c-1)*(c-2)+3*c*(c-1)+c
    c = o
    ans += c*(c-1)*(c-2)+3*c*(c-1)+c
    print(ans)

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

if K%2 == 1:
  print((N//K)**3)
else:
  print((N//K)**3 + (1+(N-K//2)//K)**3)

n, k = map(int, input().split())
rem0 = n // k
remhalf = (n // k + 1 if (n // k) * k + k // 2 <= n else n // k)
ans = rem0 ** 3 + (remhalf ** 3 if k % 2 == 0 else 0)
print(ans)

#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    e = sum(i%K!=0 and i*2%K==0 for i in range(1, N+1))
    z = sum(i%K==0 for i in range(1, N+1))
    return pow(e, 3) + pow(z, 3)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
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
    print((solve(N, K)))

def test():
    import doctest
    doctest.testmod()

def __starting_point():
    #test()
    main()

__starting_point()

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


# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect

sys.setrecursionlimit(10**6)
def zz():
    return list(map(int, sys.stdin.readline().split()))


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


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]

def nck(n, k, mod=10**9+7):
    bunbo = bunshi = 1
    for i in range(k):
        bunshi = (bunshi * (n-i)) % mod
        bunbo = (bunbo * (i+1)) % mod
    return (bunshi * pow(bunbo, mod-2, mod)) % mod

N,K=zz()
ans = 0
modK = 0
if (K % 2 == 0):
    mod0 = N//K
    ans += mod0**3
    a = (N + K//2)//K
    # print(a)
    ans+=a**3
else:
    mod0 = N // K
    ans=mod0**3
print(ans)

n, k = list(map(int, input().split()))
num = [0] * k
for i in range(1, n+1):
    num[i % k] += 1
ans = 0
for a in range(k):
    b = (k-a) % k
    c = (k-a) % k
    if ((b+c) % k != 0):
        continue
    ans += num[a] * num[b] * num[c]
print(ans)


n,k = map(int, input().split())
ans = (n//k)**3
if (k%2==0):
    ans += (n//(k//2)-n//k)**3
print(ans)

n,k = 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)

def solve():
    n, k = list(map(int, input().split()))
    if k % 2 != 0:
        print(((n // k) ** 3))
    else:
        print(((n // k) ** 3 + ((n + k // 2) // k) ** 3))


def __starting_point():
    solve()

__starting_point()

def main():
    n,k=map(int,input().split())
    ans=0
    baisuu=n//k
    ans+=baisuu**3
    if k%2==0:
        if baisuu*k+k//2<=n:
            hanbun=baisuu+1
        else:
            hanbun=baisuu
        ans+=hanbun**3
    print(ans)
def __starting_point():
    main()
__starting_point()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = list(map(int, readline().split()))

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

    ans = 0
    for a in range(K):
        b = c = (K - a) % K
        if (b + c) % K == 0:
            ans += R[a] * R[b] * R[c]

    print(ans)
    return


def __starting_point():
    main()

__starting_point()

n, k = list(map(int, input().split()))
n0 = n//k
ans = pow(n0, 3)
if k%2 == 0:
    # a,b,c全ての余りがk/2のパターン
    r = n%k
    ans += pow(n0+int(n%k>=k//2), 3)
print(ans)


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

r = n // k
res = r **3
if k % 2 == 0:
    s = r
    if n % k >= k//2:
        s += 1
    res += s ** 3
print(res)

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = list(map(int, readline().split()))

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

    print(ans)
    return


def __starting_point():
    main()

__starting_point()

#プログラミング日記   一寸先は闇が人生
# https://pyteyon.hatenablog.com/entry/2018/09/02/094228
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())

# 偶数、奇数共に
# a,b,c mod 0,0,0 ⇒Kの倍数
multip_K =[i for i in range(K,N+1,K)]

#multip_Kから３つ選び並べる順列組み合わせ
le =len(multip_K)
ans_mod_0 =le **3

# 偶数のみ
# a,b,c mod K/2,K/2,K/2 
ans_mod_haf =0
if K%2 ==0:
    multip_haf =[i for i in range(1,N+1) if i %K ==K//2 ]
    le_haf =len(multip_haf)
    ans_mod_haf =le_haf **3

ans =ans_mod_0 +ans_mod_haf
print(ans)

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

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

ans = 0
for a in range(1, n+1):
    mod = a % k
    temp_mod = (k-mod)%k
    #print(temp_mod)
    if (temp_mod*2) % k != 0:
        continue
    ans += num[temp_mod]**2
print(ans)


a = list(map(int,input().split()))
b = a[0]//a[1]
if a[1] % 2 != 0:
  print((b**3))
else:
  if a[0]%a[1] >= a[1]//2:
    print((b**3 + (b+1)**3))
  else:
    print((2*b**3))
  


n,k=map(int, input().split())
if k%2==0:
  cnt1=n//k
  cnt2=n//k
  if n%k>=k//2:
    cnt2+=1
  print(cnt1**3+cnt2**3)
else:
  print((n//k)**3)

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = list(map(int, readline().split()))

    ans = 0
    step = K if K % 2 else K // 2

    for a in range(step, N + 1, step):
        l = a // K + 1
        r = (N + a) // K
        if r >= l:
            ans += (r - l + 1) ** 2

    print(ans)
    return


def __starting_point():
    main()

__starting_point()

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)


n, k = map(int, input().split())
if k % 2 == 1:
    print((n // k)**3)
else:
    ans = (n//k)**3
    ans += (n//(k//2)-n//k)**3
    print(ans)

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

if K%2==1:
    print((N//K)**3)
else:
    a=N//K
    b=N//(K//2)
    print(a**3+(b-a)**3)

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

if K % 2 == 1:
  n = N//K
  print(n**3)
  return

n = N // (K//2)
n_odd, n_even = (n+1)//2,n//2
print(n_odd**3+n_even**3)

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, K):
    div0 = N // K
    divh = (N + (K // 2)) // K if K % 2 == 0 else 0
    import math
    print((div0 ** 3 + divh ** 3))


def __starting_point():
    # S = input()
    # N = int(input())
    N, K = list(map(int, input().split()))
    # A = [int(i) for i in input().split()]
    # B = [int(i) for i in input().split()]
    # AB = [[int(i) for i in input().split()] for _ in range(N)]
    solve(N, K)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

__starting_point()

#!/usr/bin/env python

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

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

print(ans)


import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = list(map(int, readline().split()))

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

    ans = 0
    for a in range(K):
        b = (K - a) % K
        if 2 * b % K == 0:
            ans += R[a] * R[b] * R[b]

    print(ans)
    return


def __starting_point():
    main()

__starting_point()

N,K = map(int,input().split())
if K % 2 == 1:
    ans = (N//K)**3
else:
    ans = (N//K)**3
    K2 = N//(K//2) - N//K
    ans += K2**3
print(ans)

N,K = map(int,input().split())
ans = (N//K)**3

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

print(ans)

n, k = map(int,input().split())
if k % 2:
    ans = (n // k)**3
else:
    ans = ((k//2 + n) // k)**3 + (n // k)**3
print(ans)

n,k = list(map(int,input().split()))
R = []
Ro = []

if k%2 != 0:
  for i in range(1,n+1):
    if i%k == 0:
      R.append(i)
   
  print((len(R)**3))
else:
  for i in range(1,n+1):
    if i%k == 0:
      R.append(i)
    if i%k == k//2:
      Ro.append(i)
  print((len(R)**3 + len(Ro)**3))


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

res = 0
for i in range(1, n + 1):
    a = i % k
    b = (-a) % k
    c = (-a) % k
    if (b + c) % k == 0:
        res += ((n + b) // k) * ((n + c) // k)
        
print(res)