N = int(input())
A = [i for i in map(int, input().split())]
trace = [0 for i in range(N)]
buy = [0 for i in range(N)]
sell = [0 for i in range(N)]
buy[0]= -A[0]
for i in range(1,N):
    buy[i] = max(buy[i-1],sell[i-1]-A[i])
    sell[i] = max(sell[i-1],buy[i-1]+A[i])
flag=0
tmp = -1
for i in range(N-1,0,-1):
    if flag ==1 and i == 1:
        trace[tmpbuy] =1
    if flag == 1 and not buy[i-1] == tmp:
        trace[tmpbuy] = 1
        flag = 0
    if sell[i-1]<buy[i-1]+A[i]:
        trace[i] = 2
        tmp = buy[i-1]
    if buy[i-1]==tmp:
        flag = 1
        tmpbuy = i-1
    if flag ==1 and i == 1:
        trace[tmpbuy] =1
n=0
M = 1000
for i in range(N):
    if trace[i] == 1:
        n = int(M/A[i])
        M = M-n*A[i]
    if trace[i] == 2:
        M = M+n*A[i]
print(M)