def solve():
    N = int(input())
    A_org = list(map(int,input().split()))
    A = [A_org[0]]
    isPosPrev = False
    for i in range(N-1):
        if A_org[i] == A_org[i+1]:
            continue

        isPosNow = True if A_org[i] < A_org[i+1] else False

        if i == 0:
            isPosPrev = isPosNow

        if isPosNow != isPosPrev:
            A.append(A_org[i])
        
        isPosPrev = isPosNow
    else:
        A.append(A_org[-1])

    A.append(-1)

    N = len(A) - 1
    for money_cand in range(10**5,1000, -1):
        money = money_cand
        stock = 0
        for i in range(N-1, -1, -1):
            if A[i] > A[i+1]:
                stock += money // A[i]
                money = money % A[i]
            elif A[i] < A[i+1]:
                money += stock * A[i]
                stock = 0
        
        else:
            money += stock * A[i]
            if money == 1000:
                print(money_cand)
                return
    
    print("1000")

if __name__ == '__main__':
    solve()