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