L, K = map(int, input().split()) count = 0 if L <= K * 2: print(0) else: while True: L -= K * 2 count += 1 if L <= K * 2: break print(K * count)