import sys, math, itertools, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 

inf = float('inf') ;mod = 10**9+7 

mans = inf ;ans = 0 ;cnt = 0 ;pro = 1



n = int(eval(input()))

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

now = 1000

for i in range(n-1):

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

        stocks = now//A[i]

        now += (A[i+1] - A[i])*stocks

print(now)
n = int(eval(input()))

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

now = 1000

for i in range(n-1):

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

        stocks = now // A[i]

        now += (A[i+1] - A[i])*stocks

print(now)
import sys, math, itertools, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
cnt = 0
pro = 1
n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n - 1):
    if A[i] < A[i + 1]:
        stocks = now // A[i]
        now += (A[i + 1] - A[i]) * stocks
print(now)

n = int(eval(input()))
A = list(map(int, input().split()))
now = 1000
for i in range(n - 1):
    if A[i] < A[i + 1]:
        stocks = now // A[i]
        now += (A[i + 1] - A[i]) * stocks
print(now)

-import sys, math, itertools, collections, bisect - -input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") -inf = float("inf") -mod = 10**9 + 7 -mans = inf -ans = 0 -cnt = 0 -pro = 1