import sys

k=1000

N=int(eval(input()))

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

i=0

while i<N-1:

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

    n=L[i]

    break

  i+=1

  if i==N-1:

    print((1000))

    sys.exit()

n=0

for j in range(i,N):

  if j==N-1 and n!=0:

    m=max(L[s:])

    c=k%n

    k=((k//n)*m)+c

    n=0

    break

  if j==N-1 and n==0:

    break

  if L[j]<L[j+1] and n==0:

    n=L[j]

    s=j

  if L[j]>L[j+1] and n!=0:

    m=L[j]

    c=k%n

    k=((k//n)*m)+c

    n=0

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

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

money = 1000

kabu = 0

for i in range(n-1):

    if a[i] < a[i+1] and money != 0:

        kabu += money // a[i]

        money -= a[i] *(money // a[i])

    elif a[i] > a[i+1] and kabu != 0:

        money += a[i] * kabu

        kabu = 0

print((money + a[-1] * kabu))
import sys

k = 1000
N = int(eval(input()))
L = list(map(int, input().split()))
i = 0
while i < N - 1:
    if L[i] < L[i + 1]:
        n = L[i]
        break
    i += 1
    if i == N - 1:
        print((1000))
        sys.exit()
n = 0
for j in range(i, N):
    if j == N - 1 and n != 0:
        m = max(L[s:])
        c = k % n
        k = ((k // n) * m) + c
        n = 0
        break
    if j == N - 1 and n == 0:
        break
    if L[j] < L[j + 1] and n == 0:
        n = L[j]
        s = j
    if L[j] > L[j + 1] and n != 0:
        m = L[j]
        c = k % n
        k = ((k // n) * m) + c
        n = 0
print(k)

n = int(eval(input()))
a = list(map(int, input().split()))
money = 1000
kabu = 0
for i in range(n - 1):
    if a[i] < a[i + 1] and money != 0:
        kabu += money // a[i]
        money -= a[i] * (money // a[i])
    elif a[i] > a[i + 1] and kabu != 0:
        money += a[i] * kabu
        kabu = 0
print((money + a[-1] * kabu))

-import sys - -k = 1000 -N = int(eval(input())) -L = list(map(int, input().split())) -i = 0 -while i < N - 1: -    if L[i] < L[i + 1]: -        n = L[i] -        break -    i += 1 -    if i == N - 1: -        print((1000)) -        sys.exit() -n = 0 -for j in range(i, N): -    if j == N - 1 and n != 0: -        m = max(L[s:]) -        c = k % n -        k = ((k // n) * m) + c -        n = 0 -        break -    if j == N - 1 and n == 0: -        break -    if L[j] < L[j + 1] and n == 0: -        n = L[j] -        s = j -    if L[j] > L[j + 1] and n != 0: -        m = L[j] -        c = k % n -        k = ((k // n) * m) + c -        n = 0 -print(k) +n = int(eval(input())) +a = list(map(int, input().split())) +money = 1000 +kabu = 0 +for i in range(n - 1): +    if a[i] < a[i + 1] and money != 0: +        kabu += money // a[i] +        money -= a[i] * (money // a[i]) +    elif a[i] > a[i + 1] and kabu != 0: +        money += a[i] * kabu +        kabu = 0 +print((money + a[-1] * kabu))