integer N,K
integer(16) nK,nK2
integer(16) ans
read*,N,K
select case(mod(K,2))
  case(0)
    nK=N/K
    nK2=(N+K/2)/K
    ans=nK**3+nk2**3
  case(1)
    nK=N/K
    ans=nk**3
end select
print"(i0)",ans
end