#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,k;cin>>n>>k;
    ll tmp=(n/k);
    ll ans=tmp*tmp*tmp;
    if(!(k%2)){
        if((n%k)>=(k/2)) tmp++;
        ans+=tmp*tmp*tmp;
    }
    printf("%lld\n",ans);
    return 0;
}
