inputs = gets.split(" ") l = inputs[0].to_i k = inputs[1].to_i if l == k*2 puts "0" exit end sum = l/2/k*k l %= k while l-2*k > 0 do sum += k l -= 2*k end puts sum