n = gets.chomp.to_i
al = gets.chomp.split.map(&:to_i)

a = Array.new(n, 0)
# 1:+, -1:-
n.times do |i|
  next if i == 0
  a[i] = 1 if al[i] - al[i-1] > 0
  a[i] = -1 if al[i] - al[i-1] < 0
  a[i] = a[i-1] if al[i] == al[i-1]
end
a[0] = -1 if a[1] == 1

ans = 1000
kabu = 0
(a.length - 1).times do |i|
  # buy
  if a[i+1]-a[i] == 2
    kabu = ans / al[i]
    ans = ans % al[i]
    next
  end
  # sell
  if a[i+1]-a[i] == -2
    ans += kabu * al[i]
    kabu = 0
    next
  end
end
ans += kabu * al[-1] if kabu > 0

p ans