n = gets.to_i
a = gets.split.map(&:to_i)
c = Array.new(n, nil)

j = 0
status = nil
(1..(n-1)).each do |i|
  if i == n - 1
    if status == "up"
      if a[i-1] < a[i]
        c[i] = 2
        c[j] = 2
      else
        c[i-1] = 2
      end
    elsif status == 'down'
      if a[i-1] < a[i]
        c[i-1] = 1
        c[i] = 2
      else
        c[i-1] = 2
      end
    else
      if a[i-1] < a[i]
        c[i-1] = 1
        c[i] = 2
      end
    end
  elsif a[i-1] < a[i]
    if status == "up"
    elsif status == 'down'
      status = 'up'
      j = i - 1
      c[j] = 1
      c[j-1] = 2
    else
      status = 'up'
      j = i - 1
      c[j] = 1
    end
  elsif a[i-1] > a[i]
    if status == "up"
      status = 'down'
      j = i
      c[j-1] = 2
    elsif status == 'down'
      j = i
    else
      status = 'down'
      j = i - 1
    end
  end
end
num_m = 1000
num_k = 0
c.each_with_index do |z, i|
  if z == 1
    k = num_m / a[i]
    num_m -= k * a[i]
    num_k += k
  elsif z == 2
    num_m += num_k * a[i]
    num_k = 0
  end
end
puts num_m