l,k=map(int,input().split()) if l%(2*k)==0: t = 0 else: t = l//(2*k) print(t*k)