n = int(input())
A = list(map(int,input().split()))
l = []
for i in range(n-1):
    if A[i] < A[i+1]:
        l.append(1)
    elif A[i] > A[i+1]:
        l.append(-1)
    else:
        l.append(0)
print (l)

m = 1000
k = 0

for i in range(n):
    if i != n-1:
        if l[i] == 1: # 株を買う
            k = m//A[i]
            m = m-k*A[i]
        elif l[i] == 0: # なにもしない
            pass
        else: # -1 なので株を売る
            m = m + A[i]*k
            k = 0
    else: #最後に株があれば全部売る
        if k != 0:
            m = m + A[i]*k

print (m)
