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