n = int(eval(input()))

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

# dp[buy][sell]

dp = [0 for j in range(n)]

dp[0] = 1000

for i in range(n):

    ai = a[i]

    m = dp[i]

    s = m // ai



    for j in range(i + 1, n):

        dp[j] = max(dp[j], m + s * (a[j] - ai))



    for j in range(n - 1):

        dp[j + 1] = max(dp[j + 1], dp[j])

print((dp[-1]))

n = int(eval(input()))

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

a_cur = a[0]



m = 1000

s = 0



for i in range(1, n):

    a_next = a[i]

    if a_cur < a_next:

        # buy current and sell next

        s = m // a_cur

        m += s * (a_next - a_cur)

    a_cur = a_next

print(m)
n = int(eval(input()))
a = list(map(int, input().split()))
# dp[buy][sell]
dp = [0 for j in range(n)]
dp[0] = 1000
for i in range(n):
    ai = a[i]
    m = dp[i]
    s = m // ai
    for j in range(i + 1, n):
        dp[j] = max(dp[j], m + s * (a[j] - ai))
    for j in range(n - 1):
        dp[j + 1] = max(dp[j + 1], dp[j])
print((dp[-1]))

n = int(eval(input()))
a = list(map(int, input().split()))
a_cur = a[0]
m = 1000
s = 0
for i in range(1, n):
    a_next = a[i]
    if a_cur < a_next:
        # buy current and sell next
        s = m // a_cur
        m += s * (a_next - a_cur)
    a_cur = a_next
print(m)

-# dp[buy][sell] -dp = [0 for j in range(n)] -dp[0] = 1000 -for i in range(n): -    ai = a[i] -    m = dp[i] -    s = m // ai -    for j in range(i + 1, n): -        dp[j] = max(dp[j], m + s * (a[j] - ai)) -    for j in range(n - 1): -        dp[j + 1] = max(dp[j + 1], dp[j]) -print((dp[-1])) +a_cur = a[0] +m = 1000 +s = 0 +for i in range(1, n): +    a_next = a[i] +    if a_cur < a_next: +        # buy current and sell next +        s = m // a_cur +        m += s * (a_next - a_cur) +    a_cur = a_next +print(m)