N = map(int,input().split())
*A, = map(int,input().split())

A = [1000]+A+[0]
Y = 1000
kabu = 0
ans = 1000
S = [[Y,kabu] for _ in [0]*3]

for a,b,c in zip(A,A[1:],A[2:]):
    if a>=b and b<c:
        #買う
        Y_max,kabu_max = S[1]
        for Y,kabu in S:
            n = Y//b
            kabu += n
            Y -= n*b
            if kabu > kabu_max:
                kabu_max = kabu
                Y_max = Y
        S[1] = [Y_max,kabu_max]
        Y2,kabu2 = S[2]
        if Y_max+kabu_max*b > Y2+kabu2*b:
            S[2] = [Y_max,kabu_max]
    if a<=b and b>c:
        #売る
        for Y,kabu in S[1:]:
            Y += b*kabu
            S[0][0] = max(S[0][0],Y)
            ans = max(ans,Y)

print(ans)