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):
    for s_n in range(-math.floor(money / a[i]), stock+1):
        if s_n == 0:
            continue
        elif s_n > 0 and stock <= 0:
            continue
        elif s_n < 0 and money <= 0:
            continue
        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]))
