N = int(input())
A = list(map(int, input().split()))
DP = [[-1 for _1 in range(10000)] for _ in range(N) ]

for i in range(1000//A[0]+1):
    DP[0][i] = 1000 - A[0]*i

max_stock = 1000//A[0]
for j in range(1, N):
    today = A[j]
    DP[j][0] = max(DP[j-1][0], DP[j-1][max_stock] + max_stock*today)
    max_stock = DP[j-1][0]//today
    DP[j][max_stock] =  DP[j-1][0] - max_stock*today




print(DP[N-1][0])