n = int(input())
a = list(map(int, input().split()))

prices = sorted(list(set(a)),key=a.index)

lmaxmin = []

for i in range(len(prices)):
    if i == 0:
        if prices[i] < prices[i+1]:
            lmaxmin.append(i)
    elif i == len(prices) - 1:
        if prices[i-1] < prices[i]:
            lmaxmin.append(i)
    elif prices[i] < prices[i+1] and prices[i-1] > prices[i]:
        lmaxmin.append(i)
    elif prices[i] > prices[i+1] and prices[i-1] < prices[i]:
        lmaxmin.append(i)


finalVal = 0

for i in range(2 ** len(lmaxmin)):
    curentVal = 1000
    stockNum = 0
    for j in range(len(lmaxmin)):
        if ((i >> j) & 1):
            ind = lmaxmin[j]
            if ind == 0:
                num = curentVal // prices[ind]
                curentVal -= prices[ind] * num
                stockNum += num
            elif ind == len(prices) - 1:
                num = stockNum
                curentVal += prices[ind] * num
                stockNum -= num
            elif prices[ind] < prices[ind+1]:
                num = curentVal // prices[ind]
                curentVal -= prices[ind] * num
                stockNum += num
            else:
                num = stockNum
                curentVal += prices[ind] * num
                stockNum -= num
    
    if finalVal < curentVal:
        finalVal = curentVal

print(finalVal)