#include <bits/stdc++.h>
using namespace std;

typedef double lf;
typedef long long ll;
typedef long double llf;
typedef pair<ll, ll> pll;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef unsigned long long ull;

bool Debug;
const int mod = 1e9 + 7, MAXN = 1e5 + 7, inft = 1e9;
const ll infl = 1ll << 60;

#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define mset(a, b) memset(a, b, sizeof(a))
#define debug(...) if (Debug) fprintf(stderr, __VA_ARGS__)
#define lop(i,a,b) for(int i = (a), i##end = (b); i <= i##end; ++i)
#define dlop(i,a,b) for(int i = (a), i##end = (b); i >= i##end; --i)
#define ergo(a) for(__typeof(a.end())it = (a).begin(), it##end = (a).end(); it != it##end; ++it)

template<class A, class B> void chmax(A &x, B y) {if (x < y) x = y;}
template<class A, class B> void chmin(A &x, B y) {if (x > y) x = y;}
template<class A, class B> A max(A a, B b) {return a > b ? a : b;}
template<class A, class B> A min(A a, B b) {return a < b ? a : b;}
template<class A, class B> A gcd(A a, B b) {if (a < b) swap(a, b); if (!b) return a; while (A t = a % b) a = b, b = t; return b;}
template<class A, class B> A lcm(A a, B b) {return a / gcd(a, b) * b;}
template<class A, class B> A Pow(A a, B b) {A ret = 1; for ( ; b; b >>= 1) {if (b & 1) ret = ret * 1ll * a; a = a * 1ll * a;} return ret;}
template<class T> inline T abs(T x) {return x >= 0 ? x : -x;}
template<class T> inline T sqr(T x) {return x * x;}


bool IS(int x) {return x == 10 || x == 13 || x == ' ';}

struct IO {
  struct Cg {inline int operator()() {return getchar();}};
  struct Cp {inline void operator()(int x) {putchar(x);}};
#define OP operator
#define RT return *this
#define RX x=0;int t=P();while((t<'0'||t>'9')&&t!='-')t=P();f=1;\
if(t=='-')t=P(),f=-1;x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0'
#define RL if(t=='.'){lf u=0.1;for(t=P();t>='0'&&t<='9';t=P(),u*=0.1)x+=u*(t-'0');}if(f==-1)x=-x;
#define RU x=0;int t=P();while(t<'0'||t>'9')t=P();x=t-'0';for(t=P();t>='0'&&t<='9';t=P())x=x*10+t-'0'
#define TR *this,x;return x
  template<typename T>struct Fr {int f; T P; inline Fr&OP, (int&x) {RX; x *= f; RT;} inline OP int() {int x; TR;} inline Fr&OP, (ll &x) {RX; x *= f; RT;} inline OP ll() {ll x; TR;} inline Fr&OP, (char&x) {for (x = P(); IS(x); x = P()); RT;} inline OP char() {char x; TR;} inline Fr&OP, (char*x) {char t = P(); for (; IS(t); t = P()); if (~t) {for (; !IS(t) && ~t; t = P()) * x++ = t;}*x++ = 0; RT;} inline Fr&OP, (lf&x) {RX; RL; RT;} inline OP lf() {lf x; TR;} inline Fr&OP, (llf&x) {RX; RL; RT;} inline OP llf() {llf x; TR;} inline Fr&OP, (uint&x) {RU; RT;} inline OP uint() {uint x; TR;} inline Fr&OP, (ull&x) {RU; RT;} inline OP ull() {ull x; TR;}};
  Fr<Cg>in;
#define WI if(x){if(x<0)P('-'),x=-x;c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0')
#define WL if(y){lf t=0.5;for(int i=y;i--;)t*=0.1;if(x>=0)x+=t;else x-=t,P('-');*this,(ll)(abs(x));P('.');if(x<0)\
x=-x;while(y--){x*=10;x-=floor(x*0.1)*10;P(((int)x)%10+'0');}}else if(x>=0)*this,(ll)(x+0.5);else *this,(ll)(x-0.5);
#define WU if(x){c=0;while(x)s[c++]=x%10+'0',x/=10;while(c--)P(s[c]);}else P('0')
  template<typename T>struct Fw {int c, s[24]; T P; inline Fw&OP, (int x) {WI; RT;} inline Fw&OP()(int x) {WI; RT;} inline Fw&OP, (uint x) {WU; RT;} inline Fw&OP()(uint x) {WU; RT;} inline Fw&OP, (ll x) {WI; RT;} inline Fw&OP()(ll x) {WI; RT;} inline Fw&OP, (ull x) {WU; RT;} inline Fw&OP()(ull x) {WU; RT;} inline Fw&OP, (char x) {P(x); RT;} inline Fw&OP()(char x) {P(x); RT;} inline Fw&OP, (const char*x) {while (*x)P(*x++); RT;} inline Fw&OP()(const char*x) {while (*x)P(*x++); RT;} inline Fw&OP()(lf x, int y) {WL; RT;} inline Fw&OP()(llf x, int y) {WL; RT;}};
  Fw<Cp>out;
} io;
#define in io.in
#define out io.out
ll ans;
int main() {
#ifdef LOCAL_DEBUG
  // Debug = freopen("data.in", "r", stdin) && freopen("data.out", "w", stdout);
#endif
  ll n, k;
  in, n, k;
  ll t = n / k, t1 = (n + k / 2) / k;
  ll ans = t * t * t;
  if (k % 2 == 0) ans += t1 * t1 * t1;
  out, ans;
  return 0;
}

Measured memory_bytes: 256