L, K = map(int, input()) eat = 2 * K count = L // eat if count * eat != L: print(K * count) else: print(K * (count - 1))