l, K = gets.split.map(&:to_i) answer = 0 loop do break if (l - K * 2) <= 0 answer += K l -= K * 2 end puts answer