L, K = map(int, input().split()) restL = L U = 0 for cnt in range (0, 10 ** 9): if restL > 2 * K: U += K restL -= 2 * K else: print(U) break