#include<iostream>
using namespace std;
int k1;
long long ans,ans1;
int main(){
	int n,k;
	cin>>n>>k;
	ans=n/k;
	if(k%2==0){
		ans1=n/k+(n%k>=k/2);
	}
	long long ret=ans*ans*ans+ans1*ans1*ans1;
	cout<<ret<<endl;
}