L,K=map(int,raw_input().split());B=2*K;print L/B*K-[0,K][L%B==0]