import math l,k = map(int,input().split()) if l/k <= 2: print(0) else: print(math.floor(l/(k*2))*k)