
object Main {
    def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        val n, k = sc.nextInt
        val ans0 = math.pow((n / k), 3).toLong
        if (k % 2 == 1) println(ans0)
        else {
            val m = n / (k / 2) - n / k
            println(ans0 + math.pow(m, 3).toLong)
        }
    }
}
