

N = int(eval(input()))

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



state = 1  # 1=buy, 0=sell

cur = (1000, 0)  # yen, stock

for i in range(N - 1):

    if state == 1 and X[i + 1] > X[i]:

        n = cur[0] // X[i]

        cur = (cur[0] - n * X[i], cur[1] + n)

        state = 0

    elif state == 0 and X[i + 1] < X[i]:

        cur = (cur[0] + cur[1] * X[i], 0)

        state = 1



# Last

print((cur[0] + cur[1] * X[-1]))



N = int(eval(input()))

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



cur = 1000

for i in range(N - 1):

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

        stocks = cur // X[i]

    else:

        stocks = 0



    cur += (X[i + 1] - X[i]) * stocks



# Last

print(cur)

N = int(eval(input()))
X = list(map(int, input().split()))
state = 1  # 1=buy, 0=sell
cur = (1000, 0)  # yen, stock
for i in range(N - 1):
    if state == 1 and X[i + 1] > X[i]:
        n = cur[0] // X[i]
        cur = (cur[0] - n * X[i], cur[1] + n)
        state = 0
    elif state == 0 and X[i + 1] < X[i]:
        cur = (cur[0] + cur[1] * X[i], 0)
        state = 1
# Last
print((cur[0] + cur[1] * X[-1]))

N = int(eval(input()))
X = list(map(int, input().split()))
cur = 1000
for i in range(N - 1):
    if X[i] < X[i + 1]:
        stocks = cur // X[i]
    else:
        stocks = 0
    cur += (X[i + 1] - X[i]) * stocks
# Last
print(cur)

-state = 1  # 1=buy, 0=sell -cur = (1000, 0)  # yen, stock +cur = 1000 -    if state == 1 and X[i + 1] > X[i]: -        n = cur[0] // X[i] -        cur = (cur[0] - n * X[i], cur[1] + n) -        state = 0 -    elif state == 0 and X[i + 1] < X[i]: -        cur = (cur[0] + cur[1] * X[i], 0) -        state = 1 +    if X[i] < X[i + 1]: +        stocks = cur // X[i] +    else: +        stocks = 0 +    cur += (X[i + 1] - X[i]) * stocks -print((cur[0] + cur[1] * X[-1])) +print(cur)