#include<cstdio>
using namespace std;
int n,k;
long long ans,cnt;
int main()
{
	scanf("%d%d",&n,&k);
	cnt=(long long)n/(long long)k;
	ans=cnt*cnt*cnt;
	if(!(k%2)) {cnt=0;for(int i=k/2;i<=n;i+=k) cnt++;ans+=cnt*cnt*cnt;}
	printf("%lld\n",ans);
	return 0;
}