import sys
input = sys.stdin.readline

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

M = 0

while M == 0:
    if len(AS) == 1:
        M = 2
    elif AS[0] >= AS[1]:
        AS.pop(0)
    else:
        M = 1

BS = [AS[0]]
T = AS[0]
B = AS[0]

if M == 2:
    print(1000)
else:
    for i in range(1, len(AS)):
        if i < len(AS)-1:
            if AS[i] > T:
                T = AS[i]
            elif AS[i] < T:
                B = AS[i]
                BS.append(T)
                BS.append(B)
                T = AS[i]
        else:
            if AS[i] > T:
                BS.append(AS[i])
    CS = [BS[0], BS[1]]
    for i in range(2, len(BS), 2):
        if BS[i+1] - BS[i] > BS[i-1] - BS[i-2]:
            CS.append(BS[i])
            CS.append(BS[i+1])
    print(CS)
    money = 1000
    kabu = 0
    for i in range(len(CS)):
        if i % 2 == 0:
            kabu = money // CS[i]
            money = money - (kabu * CS[i])
        else:
            money = money + (kabu * CS[i])
            kabu = 0
    print(money)