class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
    @a = gets.to_s.split.map{ |v| v.to_i }
    @b = compact
    @m = @b.size
    @money = 1000
    @stock = 0
  end

  def compact
    ans = []
    @a.each { |v| ans << v if ans.empty? || ans[-1] != v }
    ans
  end

  def solve
    m.times do |i|
      case judge(i)
      when 1
        buy(i)
      when 2
        sell(i)
      end
    end
    @money
  end

  def judge(i)
    return 1 if i == 0 && b[i] < b[i+1]
    return 2 if i == m - 1
    return 1 if b[i-1] > b[i] && b[i] < b[i+1]
    return 2 if b[i-1] < b[i] && b[i] > b[i+1]
  end

  def buy(i)
    unit = @money / b[i]
    @stock += unit
    @money -= unit * b[i]
  end

  def sell(i)
    @money += @stock * b[i]
    @stock = 0
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end