N = int(input())
A = list(map(int, input().split()))

B = [(1000, 0)]

for a in A:
    C = []
    for b1, b2 in B:
        C.append((b1, b2))
        if b1 >= a: C.append((b1 % a, b2 + b1 // a))
        if b2: C.append((b1 + b2 * a, 0))
    B = C
    
answer = 1000
for b1, b2 in B:
    if answer < b1:
        answer = b1
print(answer)