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