END { load __FILE__ unless $stdin.eof? }

n = gets.to_i
a = gets.split.map!(&:to_i) << 0

k = 0
m = 1000

a.each_cons(2) do |x, y|
  if x < y
    s, t = m.divmod(x)
    k += s
    m = t
  else
    m += k * x
    k = 0
  end
end

puts m
