N = int(input())
A = tuple(dict.fromkeys(map(int, input().split())))
pattern = []
for i in range(2 ** len(A)):
  money, stock = 1000, 0
  for j in range(len(A)):
    if i >> j & 1:
      if stock:
        money += stock * A[j]#?
        stock = 0
      else:
        stock = money // A[j]
        money %= A[j]
  pattern.append(money)
print(max(pattern))