#include<cstdio>

using namespace std;

int main(){
  int n,k;
  long cnt1=0,cnt2=0;
  scanf("%d %d",&n,&k);
  for(int i=1;i<=n;i++){
    if(i%k==0)
      cnt1++;
    if(i%k==k/2&&k%2==0)
      cnt2++;
  }
  printf("%ld\n",cnt1*cnt1*cnt1+cnt2*cnt2*cnt2);
}