n=int(input())
d = list(map(int,input().split()))
day = [d[0]]
for i in range(n-1):
    if d[i] == d[i+1]:
        continue
    day.append(d[i+1])
day = [1000]+day+[0]
print(day)
up = []
for i in range(len(day)-2):
    if day[i] < day[i+1] and day[i+1] > day[i+2]:
        up.append(day[i+1])
    elif day[i] > day[i+1] and day[i+1] < day[i+2]:
        up.append(day[i+1])
print(up)
if day[-1] > up[-1]:
    up.append(day[-1])

kabu = 0
money = 1000
for i in range(len(up)-1):
    if up[i] < up[i+1]:
        kabu += money//up[i]
        money -= kabu*up[i]
    elif up[i] > up[i+1]:
        money += kabu*up[i]
        kabu = 0
    #print(kabu,money)
money += kabu*up[-2]
print(money)  
    


