N = int(eval(input()))

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



money = 1000

stock = 0



for i in range(N):

    if i == N - 1:

        money += stock * A[i]

        break

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

        buy_stock = money // A[i]

        money -= A[i] * buy_stock

        stock += buy_stock

    elif A[i] > A[i + 1]:

        money += A[i] * stock

        stock = 0



print(money)

N = int(eval(input()))

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



money = 1000

stock = 0



for i in range(N):

    if i == N - 1:

        money += stock * A[i]

        break

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

        stock += money // A[i]

        money %= A[i]

    elif A[i] > A[i + 1]:

        money += A[i] * stock

        stock = 0



print(money)

N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N):
    if i == N - 1:
        money += stock * A[i]
        break
    if A[i] < A[i + 1]:
        buy_stock = money // A[i]
        money -= A[i] * buy_stock
        stock += buy_stock
    elif A[i] > A[i + 1]:
        money += A[i] * stock
        stock = 0
print(money)

N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(N):
    if i == N - 1:
        money += stock * A[i]
        break
    if A[i] < A[i + 1]:
        stock += money // A[i]
        money %= A[i]
    elif A[i] > A[i + 1]:
        money += A[i] * stock
        stock = 0
print(money)

-        buy_stock = money // A[i] -        money -= A[i] * buy_stock -        stock += buy_stock +        stock += money // A[i] +        money %= A[i]