def solve():
    N = int(input())
    A = list(map(int,input().split()))
    A.append(-1)

    for money_cand in range(10**4,1000-1, -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()