N=io.read("n")
K=io.read("n")
if K%2==1 then
  s=0
  for i=K,N,K do
    s=s+1
  end
  s=s*s*s
end
if K%2==0 then
  s=0
  for i=K//2,N,K//2 do
    s=s+1
  end
  if s%2==0 then
    s=s*s*s//4
  else
    s=math.ceil((s//2)^3+(s//2+1)^3)
  end
end
print(s)