L,K=map(int,input().split()) c=0 while L>K: L-=K*2 c+=1 if L<=0: print(0) else: print(c*K)