#include <cstdio>
using namespace std;
long long n,k,i,j;
int main()
{
	scanf("%lld%lld",&n,&k);
	i=n/k;
	if(k%2)
		printf("%lld",i*i*i);
	else
	{
		j=n/(k/2)-i;
		printf("%lld",i*i*i+j*j*j);
	}
	return 0;
}