N=int(eval(input()))

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

money=1000

for i in range(N-1):

    stock=0

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

        stock=money//A[i]

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

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]=max(dp[i-1],dp[i-1]//A[i-1]*A[i]+dp[i-1]%A[i-1])

print((dp[-1]))
N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
for i in range(N - 1):
    stock = 0
    if A[i] < A[i + 1]:
        stock = money // A[i]
        money += (A[i + 1] - A[i]) * stock
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] = max(dp[i - 1], dp[i - 1] // A[i - 1] * A[i] + dp[i - 1] % A[i - 1])
print((dp[-1]))

-money = 1000 -for i in range(N - 1): -    stock = 0 -    if A[i] < A[i + 1]: -        stock = money // A[i] -        money += (A[i + 1] - A[i]) * stock -print(money) +dp = [0] * N +dp[0] = 1000 +for i in range(1, N): +    dp[i] = max(dp[i - 1], dp[i - 1] // A[i - 1] * A[i] + dp[i - 1] % A[i - 1]) +print((dp[-1]))