import sys

N = int(eval(input()))

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



kai = [False] * N

uri = [False] * N

# 買いポイント探す

i = 0





# すべて同じ株価or単調減少

tmp = A[0]

flag = True

for i in range(1, N):

    if A[i-1] < A[i]:

        flag = False



if flag:

    print((1000))

    sys.exit(0)



start = 10000

stop = 10000



for i in range(1, N):

    if A[i-1] < A[i] and stop != i-1:

        start = i-1

        stop = i

    elif A[i-1] < A[i] and stop == i-1:

        stop = i

    elif A[i-1] >= A[i] and start != 10000 and stop != 10000:

        kai[start] = True

        uri[stop] = True

        start = 10000

        stop = 10000

    if i == N-1 and start != 10000 and stop != 10000:

        kai[start] = True

        uri[stop] = True

cnt = 0

kingaku = 1000

for i in range(N):

    if kai[i]:

        cnt = kingaku // A[i]

        kingaku -= A[i] * cnt

    if uri[i]:

        kingaku += A[i] * cnt

        cnt = 0

    if i == N-1:

        kingaku += A[i] * cnt

print(kingaku)









N = int(eval(input()))

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



dp = [0]*(N)

dp[0] = 1000



for i in range(1,N):

    dp[i] = dp[i-1]

    for j in range(i):

        dp[i] = max(dp[i], (dp[j]//A[j])*A[i]+dp[j]%A[j])

ans = 0

for i in range(N):

    ans = max(ans, dp[i])

print(ans)
import sys

N = int(eval(input()))
A = list(map(int, input().split()))
kai = [False] * N
uri = [False] * N
# 買いポイント探す
i = 0
# すべて同じ株価or単調減少
tmp = A[0]
flag = True
for i in range(1, N):
    if A[i - 1] < A[i]:
        flag = False
if flag:
    print((1000))
    sys.exit(0)
start = 10000
stop = 10000
for i in range(1, N):
    if A[i - 1] < A[i] and stop != i - 1:
        start = i - 1
        stop = i
    elif A[i - 1] < A[i] and stop == i - 1:
        stop = i
    elif A[i - 1] >= A[i] and start != 10000 and stop != 10000:
        kai[start] = True
        uri[stop] = True
        start = 10000
        stop = 10000
    if i == N - 1 and start != 10000 and stop != 10000:
        kai[start] = True
        uri[stop] = True
cnt = 0
kingaku = 1000
for i in range(N):
    if kai[i]:
        cnt = kingaku // A[i]
        kingaku -= A[i] * cnt
    if uri[i]:
        kingaku += A[i] * cnt
        cnt = 0
    if i == N - 1:
        kingaku += A[i] * cnt
print(kingaku)

N = int(eval(input()))
A = list(map(int, input().split()))
dp = [0] * (N)
dp[0] = 1000
for i in range(1, N):
    dp[i] = dp[i - 1]
    for j in range(i):
        dp[i] = max(dp[i], (dp[j] // A[j]) * A[i] + dp[j] % A[j])
ans = 0
for i in range(N):
    ans = max(ans, dp[i])
print(ans)

-import sys - -kai = [False] * N -uri = [False] * N -# 買いポイント探す -i = 0 -# すべて同じ株価or単調減少 -tmp = A[0] -flag = True +dp = [0] * (N) +dp[0] = 1000 -    if A[i - 1] < A[i]: -        flag = False -if flag: -    print((1000)) -    sys.exit(0) -start = 10000 -stop = 10000 -for i in range(1, N): -    if A[i - 1] < A[i] and stop != i - 1: -        start = i - 1 -        stop = i -    elif A[i - 1] < A[i] and stop == i - 1: -        stop = i -    elif A[i - 1] >= A[i] and start != 10000 and stop != 10000: -        kai[start] = True -        uri[stop] = True -        start = 10000 -        stop = 10000 -    if i == N - 1 and start != 10000 and stop != 10000: -        kai[start] = True -        uri[stop] = True -cnt = 0 -kingaku = 1000 +    dp[i] = dp[i - 1] +    for j in range(i): +        dp[i] = max(dp[i], (dp[j] // A[j]) * A[i] + dp[j] % A[j]) +ans = 0 -    if kai[i]: -        cnt = kingaku // A[i] -        kingaku -= A[i] * cnt -    if uri[i]: -        kingaku += A[i] * cnt -        cnt = 0 -    if i == N - 1: -        kingaku += A[i] * cnt -print(kingaku) +    ans = max(ans, dp[i]) +print(ans)