object Main { def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val L, K = sc.nextInt val d = L / (K * 2) val m = L % (K * 2) if (m == 0) { println(K * (d-1)) } else { println(K * d) } } }