n = int(eval(input()))

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

lst = [[0, [0, 0]] for _ in range(n)]



lst[0][0] = 1000

lst[0][1][0] = 1000 // alst[0]

lst[0][1][1] = 1000 % alst[0]

for i, num in enumerate(alst[1:], start = 1):

    m1 = lst[i - 1][1][1] + lst[i - 1][1][0] * num

    lst[i][0] = max(lst[i - 1][0], m1)

    lst[i][1][0] = lst[i][0] // num

    lst[i][1][1] = lst[i][0] % num

    

print((lst[-1][0]))
n = int(eval(input()))

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

dp = [[1000, [0, 0]]]



for a in alst:

    tmp1 = max(dp[-1][0], dp[-1][1][0] * a + dp[-1][1][1])

    tmp2 = tmp1 // a

    tmp3 = tmp1 % a

    dp.append([tmp1, [tmp2, tmp3]])

print((dp[-1][0]))
n = int(eval(input()))
alst = list(map(int, input().split()))
lst = [[0, [0, 0]] for _ in range(n)]
lst[0][0] = 1000
lst[0][1][0] = 1000 // alst[0]
lst[0][1][1] = 1000 % alst[0]
for i, num in enumerate(alst[1:], start=1):
    m1 = lst[i - 1][1][1] + lst[i - 1][1][0] * num
    lst[i][0] = max(lst[i - 1][0], m1)
    lst[i][1][0] = lst[i][0] // num
    lst[i][1][1] = lst[i][0] % num
print((lst[-1][0]))

n = int(eval(input()))
alst = list(map(int, input().split()))
dp = [[1000, [0, 0]]]
for a in alst:
    tmp1 = max(dp[-1][0], dp[-1][1][0] * a + dp[-1][1][1])
    tmp2 = tmp1 // a
    tmp3 = tmp1 % a
    dp.append([tmp1, [tmp2, tmp3]])
print((dp[-1][0]))

-lst = [[0, [0, 0]] for _ in range(n)] -lst[0][0] = 1000 -lst[0][1][0] = 1000 // alst[0] -lst[0][1][1] = 1000 % alst[0] -for i, num in enumerate(alst[1:], start=1): -    m1 = lst[i - 1][1][1] + lst[i - 1][1][0] * num -    lst[i][0] = max(lst[i - 1][0], m1) -    lst[i][1][0] = lst[i][0] // num -    lst[i][1][1] = lst[i][0] % num -print((lst[-1][0])) +dp = [[1000, [0, 0]]] +for a in alst: +    tmp1 = max(dp[-1][0], dp[-1][1][0] * a + dp[-1][1][1]) +    tmp2 = tmp1 // a +    tmp3 = tmp1 % a +    dp.append([tmp1, [tmp2, tmp3]]) +print((dp[-1][0]))