fun main(args: Array){ var (a,b)=readLine()!!.split(" ").map(String::toInt) if (a / (b * 2) == 2 && a % (b * 2) == 0) { println(0) } else if (a % (b * 2) == 0) { println(((a / (b * 2)) - 1) * b) } else { println((a / (b * 2)) * b) } }