n = int(input())
A = list(map(int, input().split()))
ans = 1000
for ii in range(2 ** n):
    for jj in range(2 ** n):
        tmp = 1000
        kab = 0
        for i in range(n):
            if (ii >> i) & 1:  # buy
                if tmp < A[i]:
                    break
                kab += tmp // A[i]
                tmp = tmp % A[i]

            if (jj >> i) & 1:  # sell
                if kab == 0:
                    break
                tmp += kab * A[i]
                kab = 0
        else:
            ans = max(ans, tmp)

print(ans)
