L,K=map(int,input().split()) kaisuu=(L-1)//(2*K) nokori=L%(2*K) tabetaryou=K*kaisuu print(tabetaryou)