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

s = (1000, 0, 0)
mmax = 1000

q = []
q.append(s)
while len(q) > 0:
    m,k,d = q.pop()
    if d == N-1:
        m += k*A[d]
        if mmax < m:
            mmax = m
    elif d == N-2:
        if A[d] > A[d+1]:
            if k > 0:
                q.append((m+k*A[d], 0, d+1))
            else:
                q.append((m,k,d+1))
        else:
            nk,nm = k,m
            if k > 0:
                nm = m + k * A[d]
                nk = 0
            if nm > A[d]:
                x = nm //A[d]
                q.append((nm-x*A[d], nk+x, d+1))
            else:
                q.append((m,k,d+1))
    else:
        q.append((m,k,d+1))
        if m > A[d]:
            x = m // A[d]
            nm = m-x*A[d]
            nk = k+x
            q.append((nm,nk,d+1))
        if k > 0:
            nm = m+k*A[d]
            q.append((nm, 0, d+1))
            x = nm // A[d]
            if x > 0:
                q.append((nm - x*A[d], x, d+1))
print(mmax)  
