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