object Main extends App {
	val Array(n, k) = scala.io.StdIn.readLine.split(" ").map(_.toLong)

	def calc(x: Long): Long = {
		x*x*x
	}

	if(k%2 == 1){
		val cnt = n/k
		println(calc(cnt))
	}else{
		val cnt0 = n/k
		val cnt1 = n/(k/2) - n/k
		println(calc(cnt1) + calc(cnt0))
	}

}