n=gets.strip.to_i
as =gets.strip.split(" ").map(&:to_i)

money = 1000
kabu = 0
as.each_with_index do |a, i|
  break if i+1 == n
  features = as[i + 1..n - 1]

  next1 = features.each_with_index do |future, i|
    if a != future
      break future
    end
  end
  next2 = features.find do |future, i|
    a != future && next1 != future
  end

  break unless next1
  if money >= a
    next unless a < next1 && (next2  == nil|| next1 > next2)
    kabu += (money/a).to_i
    money = money - (kabu * a)
  else
    next unless a > next1 && (next2 == nil || next1 < next2)
    money += kabu * a
    kabu = 0
  end
end
if kabu >= 1
  money += kabu * as.last
end
puts money
