#include<bits/stdc++.h>
#pragma GCC optimize(3)
namespace ZDY{
    #define res register
    #define ri res int
    #define ll long long
    #define db double
    #define il inline
    #define MB template <class T>
    #define Fur(i,x,y) for(ri i=x;i<=y;i++)
    #define fur(i,x,y) for(i=x;i<=y;i++)
    #define Fdr(i,x,y) for(ri i=x;i>=y;i--)
    #define in2(x,y) in(x),in(y)
    #define in3(x,y,z) in2(x,y),in(z)
    #define in4(a,b,c,d) in2(a,b);in2(c,d)
    #define outn(x) out(x),pc('\n')
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fl(i,x) for(ri i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define inf 2147483647
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdin)
    #define gt io.gc()
    MB il T ABS(T x){return x>0?x:-x;}
    MB il T MAX(T x,T y){return x>y?x:y;}
    MB il T MIN(T x,T y){return x<y?x:y;}
    MB il T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB il void SWAP(T x,T y){T t=x;y=t;x=y;}
}using namespace ZDY;using namespace std;
class IO{
    #define fok (ch!=EOF)
    #define sep (ch==' '||ch=='\n'||ch=='\t')
    #define dsep !isdigit(ch)
    #define neq(a,b) ((a)-(b)>1e-6)
    char rbuf[1000002],wbuf[1000002],b,*p1,*p2;
    int rs,ws,S;
    public:
        IO():p1(rbuf),p2(wbuf),S(1000000),rs(1000000),ws(-1),b(1){}
        ~IO(){fwrite(wbuf,1,ws+1,stdout);}
        il char gc(){return rs==S&&(p1=rbuf,rs=-1,(S=fread(rbuf,1,S+1,stdin)-1)==-1)?(b=0,EOF):(++rs,*p1++);}
        il void pc(int x){ws==1000000&&(p2=wbuf,ws=-1,fwrite(wbuf,1,1000001,stdout)),++ws,*p2++=x;}
        il void puts(const char str[]){fwrite(wbuf,1,ws+1,stdout)?(ws=-1):0,fwrite(str,1,strlen(str),stdout);}
        il void gl(string& s){for(res char ch;(ch=gc())!='\n'&&fok;)s+=ch;}
        il IO& operator>>(int& x){x=0;res char f=0,ch=gc();while(dsep&&fok)f|=(ch=='-'),ch=gc();while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48),ch=gc();return x=f?-x:x,*this;}
        il IO& operator>>(ll& x){x=0;res char f=0,ch=gc();while(dsep&&fok)f|=(ch=='-'),ch=gc();while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48),ch=gc();return x=f?-x:x,*this;}
        il IO& operator>>(char& ch){return ch=gc(),*this;}
        il IO& operator>>(string& s){res char ch=gc();while(sep&&fok)ch=gc();while(!sep&&fok)s+=ch,ch=gc();return *this;}
        il IO& operator>>(double& x){x=0;res char f=0,ch=gc();double d=0.1;while(dsep&&fok)f|=(ch=='-'),ch=gc();while(isdigit(ch))x=x*10+(ch^48),ch=gc();if(ch=='.')while(isdigit(ch=gc()))x+=d*(ch^48),d*=0.1;return x=f?-x:x,*this;}
        il IO& operator<<(int x){res char ch[10],i=-1;!x?(pc('0'),0):0,x<0?(pc('-'),x=-x):0;while(x)ch[++i]=x%10+48,x/=10;while(~i)pc(ch[i]),--i;return *this;}
        il IO& operator<<(ll x){res char ch[20],i=-1;!x?(pc('0'),0):0,x<0?(pc('-'),x=-x):0;while(x)ch[++i]=x%10+48,x/=10;while(~i)pc(ch[i]),--i;return *this;}
        il IO& operator<<(char ch){return pc(ch),*this;}
        il IO& operator<<(char str[]){return puts(str),*this;}
        il IO& operator<<(double x){int y=int(x);*this<<y;x-=y;while(neq(x,int(x)))x*=10;x?*this<<'.'<<int(x):0;return *this;}
        il operator bool(){return b;}
}io;
#define N 1000001
ll n,k,p,ans;
int main(){
    io>>n>>k;
    p=n/k;
    ans=p*p*p;
    if(k%2==0){
        p=(n+(k/2))/k;
        ans+=p*p*p;
    }
    io<<ans<<'\n';
}

Measured memory_bytes: 256