# D - Road to Millionaire
def sell(asset, price):
  return price * asset[1] + asset[0]


def buy(money, price):
  stock = money // price
  remainder = money % price
  
  return (remainder, stock)


import copy

N = int(input())
A = list(map(int, input().split()))

# タプルのset
assets = [(1000, 0)]


for i in range(N - 1):
  assets_copy = copy.deepcopy(assets)
  money = 0
  
  for a in assets_copy:
    money = max(money, sell(a, A[i]))  
  
    assets.append((money, 0))
    assets.append(buy(money, A[i]))

ans = 0

for a in assets:
  ans = max(ans, sell(a, A[N - 1]))

print(ans)