def check(x)
  c = 0
  while x>0
    ppc = x.to_s(2).count('1')
    x %= ppc
    c += 1
  end
  return c
end
# x : 株, y : 金, b : 売買
# y(n+1) = y(n) + a(n)*x(n)
# y(k+1) = y(k) + a(k)*b(k)
# x(k+1) = x(k) - b(k)
# y(0) = 1000, x(0) = 0
# y(k)/a(k) <= b(k) <= x(k)

n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
y = 1000
amin = a[0]
amax = amin
f = 0
1.upto(n-1) do |i|
  if f == 0
    if a[i] < amin
      amin = a[i]
      amax = amin
    elsif a[i] > amin
      f = 1
      amax = a[i]
    end
  elsif f > 0
    if a[i] > amax
      amax = a[i]
    elsif a[i] < amax
      f = -1
      y += (y/amin)*(amax-amin)
      amin = a[i]
      amax = amin
    end
  else
    if a[i] < amin
      amin = a[i]
      amax = amin
    elsif a[i] > amin
      f = 1
      amax = a[i]
    end
  end
end
if amax > amin
  y += (y/amin)*(amax-amin)
end
p y
