import sys
sys.setrecursionlimit(10**6)

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

ans = 1000

def dfs(money, share, day):
    global ans
    if day > n:
        ans = max(ans, money)
        return
    max_buy = money//A[day-1]
    max_sel = share
#    for n_buy in range(-max_sel, max_buy+1):
#        dfs(money-n_buy*A[day-1], share+n_buy, day+1)
    for n_buy in [-max_sel, 0, max_buy]:
        dfs(money-n_buy*A[day-1], share+n_buy, day+1)

dfs(1000,0,1)

print(ans)