N = int(eval(input()))

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



money = 1000

kabu = 0

toku = 0

min_val = 10000



for i in range(N):

    if (A[i] < min_val):

        min_val = A[i]



    if (A[i] > min_val):

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

        min_val = A[i]



print(money)

N = int(eval(input()))

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



money = 1000

min_val = 10000



for i in range(N):

    if (A[i] < min_val):

        min_val = A[i]



    if (A[i] > min_val):

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

        min_val = A[i]



print(money)

N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
kabu = 0
toku = 0
min_val = 10000
for i in range(N):
    if A[i] < min_val:
        min_val = A[i]
    if A[i] > min_val:
        money += (money // min_val) * (A[i] - min_val)
        min_val = A[i]
print(money)

N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
min_val = 10000
for i in range(N):
    if A[i] < min_val:
        min_val = A[i]
    if A[i] > min_val:
        money += (money // min_val) * (A[i] - min_val)
        min_val = A[i]
print(money)

-kabu = 0 -toku = 0