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

max = 1000
s = 1000
kabu = 0
for k in itertools.combinations_with_replacement(range(-11,12), n):
	for i in range(n):
		if k[i] < 0 and abs(k[i])*a[i] <= s:
			s -= abs(k[i])*a[i]
			kabu += abs(k[i])
		if k[i] > 0 and kabu >= k[i]:
			s += k[i]*a[i]
			kabu -= k[i]

	if s > max:
		max = s
	s = 1000
	kabu = 0
print(max)