a,b = map(int,input().split()) count = a // (b * 2) if a == (b * 2): print(0) else: print(count * b)