N = gets.to_i
A = gets.chomp.split.map(&:to_i)

DEBUG = false

oper = Array.new(A.size)

current = 99
(A.size - 1).downto(0){ |i|
  puts A[i] if DEBUG
  if A[i] > current
    puts :sell if DEBUG
    oper[i] = :sell
    current = A[i]
  elsif A[i] < current
    puts :buy if DEBUG
    oper[i] = :buy
    current = A[i]
  else
    oper[i] = nil
  end
}


wallet = 1000
stock_num = 0
oper.each.with_index{ |o, i|
  case o
  when :buy
    price = A[i]
    buy_num = wallet / price
    wallet = wallet - buy_num * price
    stock_num = stock_num + buy_num
  when :sell
    price = A[i]
    wallet = wallet + stock_num * price
    stock_num = 0
  end
}

puts wallet
