unittest
{
	assert( [ "1 1" ].solve == 1 );		// 追加ケース
	assert( [ "1 2" ].solve == 1 );		// 追加ケース
	assert( [ "1 3" ].solve == 0 );		// 追加ケース
	assert( [ "10 1" ].solve == 1000 );		// 追加ケース
	
	assert( [ "3 2" ].solve == 9 );
	assert( [ "5 3" ].solve == 1 );
	assert( [ "31415 9265" ].solve == 27 );
	assert( [ "35897 932" ].solve == 114191 );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto k = 0L;
	input.front.formattedRead!"%s %s"( n, k );
	
	auto ans = ( n / k ) ^^ 3;
	if( k % 2 == 0 ) ans += ( ( n / ( k / 2 ) + 1 ) / 2 ) ^^ 3;
	return ans;
}
