n = int(input())
a = list(map(int,input().split()))

from collections import defaultdict
k_y = defaultdict(int)
k_y[0] = 1000

#for hk,hy in k_y.items(): #所持株、金
#	print(hk,hy)

k_y_new = [ vvv for vvv in k_y.values()]
for i in range(n):
	for hk,hy in k_y.items(): #所持株、金
		kk = 0#想定所持株数
		while True:
			genkin = (hk - kk) * a[i] + hy
			
			if genkin < 0 :
				break
			else:
				if kk >= len(k_y_new):
					#print('add',genkin)
					k_y_new.append( genkin )
				else:
					#print('repl',k_y_new[kk], genkin)
					k_y_new[kk] = max(k_y_new[kk], genkin)
				kk = kk + 1
		#print( k_y_new )
	k_y = {x:y for x,y in enumerate(k_y_new)}
print( k_y_new[0] )
