n = gets.to_i
nums = gets.split.map(&:to_i)
rest = 1000
stock = 0
waiting_to_buy = true
previous = nums.first
last_price = previous
nums[1..-1].each do |num|
  if waiting_to_buy && num <= previous
    previous = num
    next
  elsif waiting_to_buy
    stock, rest = rest.divmod(previous)
    previous = num
    waiting_to_buy = !waiting_to_buy
    last_price = num
  elsif !waiting_to_buy && num >= previous
    previous = num
    next
  elsif !waiting_to_buy
    rest = previous * stock
    stock = 0
    previous = num
    waiting_to_buy = !waiting_to_buy
  end
end
puts rest + [last_price, nums.last].max * stock
