N = int(input())
A = [int(a) for a in input().split()]

money = 1000
all_results = []
def dfs(day, money, kab):
    if day == N:
        money += A[-1]*kab
        all_results.append(money)

    else:
        # buy
        buy_kab = 1
        while money-A[day-1]*buy_kab >= 0:
            dfs(day+1, money-A[day-1]*buy_kab, kab+buy_kab)
            buy_kab += 1
        # sell or do nothing
        for sell_kab in range(0, kab+1):
            dfs(day+1, money+A[day-1]*sell_kab, kab-sell_kab)

dfs(1, 1000, 0)
print(max(all_results))