length, each_event_size = map(int, input().split()) cnt = 0 current_length = length while True: if current_length - each_event_size * 2 <= 0: print(each_event_size * cnt) break else: current_length -= each_event_size * 2 cnt += 1