n,m = list(map(int,input().split())) cou = 0 while True: n -= m * 2 if n < 1: break cou += 1 print(cou*m)