n = gets.to_i
INF = Float::INFINITY
M = 100
a = [0] + gets.split(" ").map(&:to_i)
dp = Array.new(n+1) { [-INF] * M }
# dp[i][j] = i日目での株の個数jでの最高金額
dp[0][0] = 1000
(1..n).each do |i|
  (0...M).each do |j|
    d = dp[i-1][j]
    (0...M).each do |k|
      if j + k < M
        d = [d, dp[i-1][j+k] + a[i] * k].max
      end
    end
    (0..j).each do |k|
      x = dp[i-1][j-k] - a[i] * k
      d = [d, x].max if x >= 0
    end
    dp[i][j] = d
  end
end

puts dp[n].max