n = gets.to_i
a = gets.chomp.split
n.times do |i|
    a[i] = a[i].to_i
end

money = 1000
stock = 0
(n - 1).times do |i|
    if a[i] < a[i + 1]
        while money >= a[i]
            money -= a[i]
            stock += 1
        end
    else
        while stock > 0
            money += a[i]
            stock -= 1
        end
    end
end

if stock > 0
    while stock > 0
        money += a.last
        stock -= 1
    end
end

puts money
