import sys

N=int(eval(input()))

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



a2list=[alist[0]]

for i in range(1,N):

  if a2list[-1]!=alist[i]:

    a2list.append(alist[i])

#print(a2list)



N2=len(a2list)

if N2==1:

  print((1000))

  sys.exit(0)



yama_list=[False]*N2

tani_list=[False]*N2

if a2list[0]>a2list[1]:

  yama_list[0]=True

if a2list[0]<a2list[1]:

  tani_list[0]=True



for i in range(1,N2-1):

  if a2list[i-1]<a2list[i]>a2list[i+1]:

    yama_list[i]=True

  if a2list[i-1]>a2list[i]<a2list[i+1]:

    tani_list[i]=True

    

if a2list[N2-2]<a2list[N2-1]:

  yama_list[N2-1]=True

if a2list[N2-2]>a2list[N2-1]:

  tani_list[N2-1]=True

    

#print(yama_list)

#print(tani_list)



money=1000

kabu=0

for i in range(N2):

  if yama_list[i]:

    #sell all

    money+=a2list[i]*kabu

    kabu=0

  if tani_list[i] and i<N2-1:

    #buy as possible

    k=money//a2list[i]

    kabu+=k

    money-=k*a2list[i]

    

print(money)
N=int(eval(input()))

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



money=1000

kabu=0

for i in range(N-1):

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

    #buy as possible

    k=money//alist[i]

    kabu+=k

    money-=k*alist[i]

  elif alist[i]>alist[i+1]:

    #sell all

    money+=alist[i]*kabu

    kabu=0



money+=alist[N-1]*kabu    

print(money)
import sys

N = int(eval(input()))
alist = list(map(int, input().split()))
a2list = [alist[0]]
for i in range(1, N):
    if a2list[-1] != alist[i]:
        a2list.append(alist[i])
# print(a2list)
N2 = len(a2list)
if N2 == 1:
    print((1000))
    sys.exit(0)
yama_list = [False] * N2
tani_list = [False] * N2
if a2list[0] > a2list[1]:
    yama_list[0] = True
if a2list[0] < a2list[1]:
    tani_list[0] = True
for i in range(1, N2 - 1):
    if a2list[i - 1] < a2list[i] > a2list[i + 1]:
        yama_list[i] = True
    if a2list[i - 1] > a2list[i] < a2list[i + 1]:
        tani_list[i] = True
if a2list[N2 - 2] < a2list[N2 - 1]:
    yama_list[N2 - 1] = True
if a2list[N2 - 2] > a2list[N2 - 1]:
    tani_list[N2 - 1] = True
# print(yama_list)
# print(tani_list)
money = 1000
kabu = 0
for i in range(N2):
    if yama_list[i]:
        # sell all
        money += a2list[i] * kabu
        kabu = 0
    if tani_list[i] and i < N2 - 1:
        # buy as possible
        k = money // a2list[i]
        kabu += k
        money -= k * a2list[i]
print(money)

N = int(eval(input()))
alist = list(map(int, input().split()))
money = 1000
kabu = 0
for i in range(N - 1):
    if alist[i] < alist[i + 1]:
        # buy as possible
        k = money // alist[i]
        kabu += k
        money -= k * alist[i]
    elif alist[i] > alist[i + 1]:
        # sell all
        money += alist[i] * kabu
        kabu = 0
money += alist[N - 1] * kabu
print(money)

-import sys - -a2list = [alist[0]] -for i in range(1, N): -    if a2list[-1] != alist[i]: -        a2list.append(alist[i]) -# print(a2list) -N2 = len(a2list) -if N2 == 1: -    print((1000)) -    sys.exit(0) -yama_list = [False] * N2 -tani_list = [False] * N2 -if a2list[0] > a2list[1]: -    yama_list[0] = True -if a2list[0] < a2list[1]: -    tani_list[0] = True -for i in range(1, N2 - 1): -    if a2list[i - 1] < a2list[i] > a2list[i + 1]: -        yama_list[i] = True -    if a2list[i - 1] > a2list[i] < a2list[i + 1]: -        tani_list[i] = True -if a2list[N2 - 2] < a2list[N2 - 1]: -    yama_list[N2 - 1] = True -if a2list[N2 - 2] > a2list[N2 - 1]: -    tani_list[N2 - 1] = True -# print(yama_list) -# print(tani_list) -for i in range(N2): -    if yama_list[i]: +for i in range(N - 1): +    if alist[i] < alist[i + 1]: +        # buy as possible +        k = money // alist[i] +        kabu += k +        money -= k * alist[i] +    elif alist[i] > alist[i + 1]: -        money += a2list[i] * kabu +        money += alist[i] * kabu -    if tani_list[i] and i < N2 - 1: -        # buy as possible -        k = money // a2list[i] -        kabu += k -        money -= k * a2list[i] +money += alist[N - 1] * kabu