n = int(input())
a = list(map(int, input().split()))

bs = [0]*n
bs1 = [0]*n

for i in range(1, n):
    if a[i-1] < a[i]:
        bs[i] = bs[i-1] + 1
    elif a[i-1] == a[i]:
        bs[i] = bs[i-1]
    else:
        bs[i] = bs[i-1] - 1

start = None
end = None
#どこで最初に買うか
for i in range(1, n):
    if bs[i] > bs[i-1]:
        start = i-1
        break

#どこで最後に売るか
for i in range(n-1, 0, -1):
    if bs[i-1] < bs[i]:
        end = i+1
        break

if start is not None:
    bs1[start] = -1
    bs1[end-1] = 1
    for i in range(start+1, end-2):
        if bs[i]-bs[i-1] > bs[i+1]-bs[i]:
            bs1[i] = 1 #売る
        elif bs[i]-bs[i-1] == bs[i+1]-bs[i]:
            bs1[i] = 0 #何もしない
        else:
            bs1[i] = -1 #買う

if start is None:
    start = 0
if end is None:
    end = n
money = 1000
stock = 0
for i in range(start, end):
    if bs1[i] == 1:
        money += stock * a[i]
        stock = 0
    elif bs1[i] == -1:
        stock = money // a[i]
        money = money % a[i]
    

print(money)