L, K = list(map(int,input().split())) rest = L yu = 0 while rest > 2 * K : rest -= 2 * K yu += 1 print( yu * K)