n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)

up_trend = a[0] < a[1]
array = []
array << a[0] if (up_trend)
max = 99
min = 201

for i in 1...a.size do
  if (up_trend)
    if (a[i] < a[i-1])
      array << a[i-1]
      up_trend = false
    end
  else
    if (a[i] > a[i-1])
      array << a[i-1]
      up_trend = true
    end
  end
end

if (a[-1] > a[-2])
  array << a[-1]
end

okane = 1000
kabu = 0
buy = true
array.each do |price|
  if (buy)
    kazu = okane / price
    kabu += kazu
    okane -= price * kazu
    buy = !buy
  else
    okane += kabu * price
    kabu = 0
    buy = !buy
  end
end
puts okane