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

ans = 0
def dfs(i, stock, money):
    global N
    global A
    global ans

    # print(i, stock, money)
    if i == N:
        ans = max(ans, money)
        return

    nextStock = int(stock)
    nextMoney = int(money)
    dfs(i+1, nextStock, nextMoney)
    
    buyStock = money//A[i]
    nextStock = stock + buyStock
    nextMoney = money - buyStock*A[i]
    dfs(i+1, nextStock, nextMoney)

    nextStock = 0
    nextMoney = money + stock * A[i]
    dfs(i+1, nextStock, nextMoney)

dfs(0, 0, 1000)
print(ans)
