#import <stdio.h>
typedef long long INT;

int main() {
    INT N, K;
    scanf("%lld %lld", &N, &K);
    INT m = N/K;
    INT count = m*m*m;
    if (K%2==0) {
        INT l = (2*N+K)/(2*K);
        count += l*l*l;
    }
    printf("%lld",count);
}
