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

local money = 1000
local kabu = 0

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