/*
 Shahadat Hossain
 I.C.T Department
 Comilla University
 Session: 2013-2014
 .
 Problem Site:
 Problem No:
 Problem Name:
 */
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<stdio.h>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>

template< class T > T _abs(T n) { return (n < 0 ? -n : n); }
template< class T > T _max(T a, T b) { return (!(a < b) ? a : b); }
template< class T > T _min(T a, T b) { return (a < b ? a : b); }
template< class T > T sq(T x) { return x * x; }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T a, T b, T c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }


/*
 vector<int> store;
 vector<vector<int>> res;
 
 void subsetgenerate(int temp){
 
 for(int i = temp; i<=n; i++){
 store.push_back(num[i]);
 res.push_back(store);
 subsetgenerate(i+1);
 store.pop_back();
 }
 }*/

/*
 int num[100];
 int n;
 int visit[110];
 int store[110];
 
 void permutation(int temp){
 
 if(temp == n + 1){
 
 for(int i = 0; i<=n; i++){
 cout<<store[i]<<" ";
 }
 cout<<endl;
 }
 for(int i = 1; i<=n; i++){
 if(visit[i] == 0){
 visit[i] = 1;
 store[temp] = num[i];
 permutation(temp + 1);
 visit[i] = 0;
 }
 }
 }
 
 const double EPS = 1e-9;
 //const long double EPS = 1e-9;
 
 const double BIG = 1e15;
 const int NIL = 0;
 const int INF = 0x3f3f3f3f;
 //const int INF = int(1e9);
 //const long int INF64 = long(1e18);
 */

int fx[]= {-1, 1, 0, 0};
int fy[]= {0, 0, 1, -1};

int dx[]= {-1, 1, 0, 0, 1, 1, -1, -1};
int dy[]= {0, 0, 1, -1, 1, -1, -1, 1};
#define inrange(x,y) x>=0 && y>=0 && x<row && y<col

int cx[] = {1,1,2,2,-1,-1,-2,-2};
int cy[] = {2,-2,1,-1,2,-2,1,-1};
#define sc2(m,n) scanf("%d %d",&m, &n)
#define sc3(m,n,o) scanf("%d %d %d",&m, &n, &o)
#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338
#define modulo 1000000007
#define SMA 300010
#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)
#define ms(a,b) memset(a, b, sizeof(a))
#define sc(n) scanf("%d",&n)
#define scs(n) scanf("%s",&n)
#define loop(i,n) for(int i = 0; i<n; i++)
#define nloop(i,n) for(int i = 1; i<=n; i++)
#define prln(n) printf("%d\n",n)
#define prsp(n) printf("%d ",n)
#define pr(n) printf("%d ",n)
#define prs(n) printf("%s",n)
#define  MAX 5

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;


ll ncr(ll n, ll r){
    
    if(r == 3){
        ll res = n*(n-1)*(n-2);
        if(res < 1)
            return 0;
        else{
            ll re = res/6;
            return re;
        }
    }
    else if(r == 2){
        ll res = n*(n-1);
        if(res < 1)
            return 0;
        else{
            ll re = res/2;
            return re;
        }
    }
    
    return 0;
}


int main(){
    
    ll n,k;
    cin>>n>>k;
    
    ll hm = n/k;
    ll sum = 0;
    
    sum += ncr(hm, 3)*6;
    sum += ncr(hm, 2)*6;
    sum += hm;
    
    
    if(k%2 == 0){
        ll ex = k/2;
        if(n%k >= ex){
            hm++;
        }
        sum += ncr(hm, 3)*6;
        sum += ncr(hm, 2)*6;
        sum += hm;

    }
    
    
    cout<<sum<<endl;
}

Measured memory_bytes: 256