local n = io.read("*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
local buycost = 1000000007

local money = 1000
local kabu = 0

for i = 1, n do
  local needbuy = false
  local needsell = false
  local sold = false
  local f = false
  for j = i + 1, n do
    if a[i] < a[j] then
      needbuy = true
    end
    if a[i] > a[j] then
      f = a[j]
    elseif f then
      if f < a[j] then
        needsell = true
      end
    end
  end
  if i == n then needsell = true end
  if 0 < kabu and needsell then
    money = money + a[i] * kabu
    kabu = 0
    sold = true
  end
  if not needsell and needbuy then
    kabu = kabu + (money // a[i])
    money = money % a[i]
  end
  -- print(i, money, kabu)
end
print(money)
