l,k = map(int,input().split()) print("0") if k*2>=l else print((l//(k*2))*k)