#No.63 ポッキーゲーム L,K = map(int,input().split()) if L % (2*K) == 0: x = ((L//(2*K))-1)*K else: x = (L//(2*K))*K print(x)