n = gets.to_i
a = gets.split.map(&:to_i)
money = 1000
stock = 0
n.times do |idx|
  current = a[idx]
  if idx.zero?
    if a[idx+1] > current
      stock, money = money.divmod(current)
    end
  elsif idx == n - 1
    money += stock * current
    stock = 0
  else
    if a[idx-1] <= current && a[idx+1] < current
      money += stock * current
      stock = 0
    elsif a[idx-1] >= current && a[idx+1] > current
      stock, money = money.divmod(current)
    end
  end
end
puts money