#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL n,k,x,ans=0;
int main()
{
    scanf("%lld%lld",&n,&k);
    if (k%2==0)
    {
        x=(n+k/2)/k;
        ans=(LL)x*x*x;
    }
    x=n/k;
    ans+=(LL)x*x*x;
    printf("%lld",ans);
    return 0;
}