pocky, eating = map(int, input().split()) count = int(pocky / (eating * 2)) if (count == 1): print(0) else: print(eating * count)