import std.stdio;
import std.string;

void main() {
    int n, k;
    readf(" %s %s", &n, &k);

    int a, b, c;
    int ans;

    int d = n * 2 / k;
    foreach(x; 1..d + 1){
        foreach(y; x..d + 1){
            foreach(z; y..d + 1){
                if ((x * k + y * k + z * k) % 2)
                    continue;
                foreach(i; 1..x * k + 1) {
                    a = i;
                    b = x * k - a;
                    c = z * k - a;
                    if (b <= n && c <= n && b > 0 && c > 0 && b + c == y * k) {
                        auto j = 1;
                        if(a != b || b != c || c != a) {
                            if(a != b && b != c && c != a)
                                j = 6;
                            else
                                j = 3;
                        }
                        ans += j;
                    }
                }

            }
        }
    }
    ans.writeln;
}
