import sys
import math
import numpy as np

n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))

ms = [[1000, 0]] # 現金, 所有株数

def transaction(money, stock):
    if stock > 0:
        # 売るケース
        for s_n in range(1, stock+1):
            state = [money + a[i]*s_n, stock-s_n]
            if state not in ms:
                ms.append(state)
    if money > 0:
        # 買うケース
        for s_n in range(1, math.floor(money / a[i])+1):
            state = [money - a[i]*s_n, stock+s_n]
            if state not in ms:
                ms.append(state)

for i in range(n):
    for (money, stock) in ms:
        transaction(money, stock)

print(max(np.array(ms)[:,0]))
