money = 1000
kabu = 0
n = gets.to_i
a = gets.split(" ").map(&:to_i)
n.times do |i|
	if a[i-1].nil?
		if a[i] <= a[i+1]
			kabu = money/a[i]
			money = money - kabu*a[i]
			puts kabu
			puts money
		elsif a[i] >= a[i+1]
			money = money + a[i]*kabu
			kabu = 0
	
	
		end
		next
	end
	if a[i+1].nil?
		if a[i] <= a[i-1]
			kabu = money/a[i]
			money = money - kabu*a[i]
	
	
		elsif a[i] >= a[i-1]
			money = money + a[i]*kabu
			kabu = 0
		end
		next
	end
	# sell
	if a[i] < a[i+1] && a[i] <= a[i-1]
		kabu = money/a[i]
		money = money - kabu*a[i]
	# buy
	elsif a[i] >= a[i+1] && a[i] > a[i-1]
		money = money + a[i]*kabu
		kabu = 0


	end
end

money + kabu * a[n-1] if kabu != 0
puts money + kabu * a[n-1]