n = gets.to_i
a = gets.split.map(&:to_i)

s = 0
e = 1
b = 1000
st = 0

while s < n-1 do
  if a[s] < a[e]
    # 底値からスタートして高値まで待つ
    while e < n-1 && a[e] <= a[e+1] do
      e += 1
    end
    p ['up',s,e]
    # buy min and sell max
    st, b = b.divmod a[s]
    b = b + st * a[e]
    st = 0
    s = e
    e += 1
  else
    # 底値まで待つ
    while e < n-1 && a[e] >= a[e+1] do
      e += 1
    end
    p ['down',s,e]
    s = e
    e += 1
  end
end

puts b
