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):

        kabu = dp[j] // A[j]

        money = dp[j] + (A[i] - A[j]) * kabu

        dp[i] = max(dp[i], money)



print((dp[-1]))
N = int(eval(input()))



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



money = 1000



for i in range(N-1):

    t = money + (A[i + 1] - A[i]) * (money // A[i])

    money = max(money, t)



print(money)
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):
        kabu = dp[j] // A[j]
        money = dp[j] + (A[i] - A[j]) * kabu
        dp[i] = max(dp[i], money)
print((dp[-1]))

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

-dp = [0] * N -dp[0] = 1000 -for i in range(1, N): -    dp[i] = dp[i - 1] -    for j in range(i): -        kabu = dp[j] // A[j] -        money = dp[j] + (A[i] - A[j]) * kabu -        dp[i] = max(dp[i], money) -print((dp[-1])) +money = 1000 +for i in range(N - 1): +    t = money + (A[i + 1] - A[i]) * (money // A[i]) +    money = max(money, t) +print(money)