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



counter = 0
while True:
    if A[counter]<A[counter+1]:
        break
    counter +=1
    if counter >= N-2:
        print(1000)
        exit()
    
value = A[counter]
num = 1000//A[counter]
flag = 1
max_ = 1000
posess = 1000%A[counter]


for i in range(counter+1,N):
    ok = A[i]
    if flag:
        print(ok,value)
        if ok > value:
            posess += num*ok
            max_ = max(max_,posess)
            num = 0
            flag = 0
            value = ok
    else:
        if ok < value :
            num = posess//ok
            posess %= ok
            flag = 1
            value = ok

            
print(max_)