L = input() K = input() i = 0 while i * K * 2 < L: i += 1 print (i -1) * K