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