def allin(m,k,d):
  if k > 0:
    return m+k*a[d], 0
  else:
    max = m // a[d]
    return m-max*a[d], k+max
  

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

ans = -1

for i in range(2**n - 1):
  money = 1000
  kabu = 0
  for j in range(n-1):
    if ((i >> j) & 1):
      money, kabu = allin(money, kabu, j)
  if kabu > 0:
    money += kabu * a[n-1]
  if ans < money:
    ans = money
    
print(ans)