# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)
a.push 0
m = 1000
k = 0
(0..(n-1)).each do |i|
  if a[i] < a[i + 1]
    dk = m / a[i]
    m -= dk * a[i]
    k += dk
  elsif a[i] > a[i + 1]
    dk = k
    m += dk * a[i]
    k -= dk
  end
end
puts m
