N = int(eval(input()))

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



lis = [0]*N



isnextup = [0]*(N-1) # -1:下がる, 0: 同じ, 1:上がる

for day in range(N-1):

    today = A[day]

    tommorow = A[day+1]

    if today < tommorow:

        isnextup[day] = 1

    elif today > tommorow:

        isnextup[day] = -1

        



money = 1000

stock = 0

for day in range(N-1):

    if isnextup[day] == 1:#底値で買う

        price = A[day]

        div, mod = divmod(money, price)

        money -= price * div

        stock += div

    elif isnextup[day] == -1: #天井で売る

        price = A[day]

        money += price * stock

        stock = 0



money += stock*A[-1]

print(money)
N = int(eval(input()))

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



money = 1000

stock = 0

for day in range(N-1):

    today_price = A[day]

    tommorow_price = A[day+1]

    if today_price < tommorow_price:

        div,mod = divmod(money, today_price)

        stock += div

        money = mod

    elif today_price > tommorow_price:

        money += today_price * stock

        stock = 0

money += A[N-1] * stock

print(money)
N = int(eval(input()))
A = list(map(int, input().split()))
lis = [0] * N
isnextup = [0] * (N - 1)  # -1:下がる, 0: 同じ, 1:上がる
for day in range(N - 1):
    today = A[day]
    tommorow = A[day + 1]
    if today < tommorow:
        isnextup[day] = 1
    elif today > tommorow:
        isnextup[day] = -1
money = 1000
stock = 0
for day in range(N - 1):
    if isnextup[day] == 1:  # 底値で買う
        price = A[day]
        div, mod = divmod(money, price)
        money -= price * div
        stock += div
    elif isnextup[day] == -1:  # 天井で売る
        price = A[day]
        money += price * stock
        stock = 0
money += stock * A[-1]
print(money)

N = int(eval(input()))
A = list(map(int, input().split()))
money = 1000
stock = 0
for day in range(N - 1):
    today_price = A[day]
    tommorow_price = A[day + 1]
    if today_price < tommorow_price:
        div, mod = divmod(money, today_price)
        stock += div
        money = mod
    elif today_price > tommorow_price:
        money += today_price * stock
        stock = 0
money += A[N - 1] * stock
print(money)

-lis = [0] * N -isnextup = [0] * (N - 1)  # -1:下がる, 0: 同じ, 1:上がる -for day in range(N - 1): -    today = A[day] -    tommorow = A[day + 1] -    if today < tommorow: -        isnextup[day] = 1 -    elif today > tommorow: -        isnextup[day] = -1 -    if isnextup[day] == 1:  # 底値で買う -        price = A[day] -        div, mod = divmod(money, price) -        money -= price * div +    today_price = A[day] +    tommorow_price = A[day + 1] +    if today_price < tommorow_price: +        div, mod = divmod(money, today_price) -    elif isnextup[day] == -1:  # 天井で売る -        price = A[day] -        money += price * stock +        money = mod +    elif today_price > tommorow_price: +        money += today_price * stock -money += stock * A[-1] +money += A[N - 1] * stock