import copy, sys
n = int(input())
a_ls = list(map(int, input().split()))
b_ls = []
for i in range(n-1):
    if a_ls[i] != a_ls[i+1]:
        b_ls.append(a_ls[i])
if a_ls[-1] != a_ls[-2]:
    b_ls.append(a_ls[-1])
if not b_ls:
    print(1000)
    sys.exit()
c_ls = [b_ls[0]]
for i in range(1,len(b_ls)-1):
    if not (b_ls[i-1] < b_ls[i] < b_ls[i+1] or b_ls[i-1] > b_ls[i] > b_ls[i+1]):
        c_ls.append(b_ls[i])
c_ls.append(b_ls[-1])
money = 1000
stock = 0
m = len(c_ls)
for i in range(m-1):
    if c_ls[i] > c_ls[i+1]:
        money += c_ls[i] * stock
        stock = 0 
    else:  
        if money > 0:
            stock, money = divmod(money, c_ls[i])
if len(c_ls) > 1 and c_ls[-1] > c_ls[-2]:
    money += c_ls[-1] * stock
print(money)
            







