def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))

n = inN()
a = inL()

kab = 0
mon = 1000
f = []
for i in range(n-1):
    if a[i+1] > a[i]:
        f.append(1)
    elif a[i+1] < a[i]:
        f.append(2)
    else:
        f.append(0)
f.append(2)
    
print(f)   
for i in range(n):

    if f[i] == 1 :
        kab += mon//a[i]
        mon = mon % a[i]
    elif f[i] == 2:
        mon += a[i]*kab
        kab = 0
    
print(mon)

