#include<iostream>
using namespace std;

int main(){
  long long  n,k;
  cin>>n>>k;
  long long sum=(n/k)*(n/k)*(n/k);
  if(k%2==0){
    long long t=n/(k/2)-n/k;
    sum+=t*t*t;
  }
  cout<<sum<<endl;
}
