def solve():

  ans = 0

  N = int(eval(input()))

  A = [float('inf')]+list(map(int, input().split()))+[-float('inf')]

  UD = [0]*(N+1)

  for i in range(N+1):

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

      UD[i] = -1

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

      UD[i] = 1

    else:

      UD[i] = UD[i-1]

  UD2 = [0]*N

  for i in range(N):

    if UD[i]>UD[i+1]:

      UD2[i] = -1

    elif UD[i]<UD[i+1]:

      UD2[i] = 1

  stock = 0

  money = 1000

  if -1 not in UD2:

    ind = -1

  else:

    ind = (N-1)-UD2[::-1].index(-1)

  for i in range(N):

    if UD2[i]==-1:

      money += A[i+1]*stock

      stock = 0

      if i==ind:

        break

    elif UD2[i]==1:

      stock,money = divmod(money,A[i+1])

  return money

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

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



def sell(money,stock,price):

  money += price*stock

  stock = 0

  return money, stock



def buy(money,price):

  stock,money = divmod(money,price)

  return money,stock



money = 1000

stock = 0

for i in range(N):

  money, stock = sell(money,stock,A[i])

  if i<N-1 and A[i]<A[i+1]:

    money, stock = buy(money,A[i])

print(money)
def solve():
    ans = 0
    N = int(eval(input()))
    A = [float("inf")] + list(map(int, input().split())) + [-float("inf")]
    UD = [0] * (N + 1)
    for i in range(N + 1):
        if A[i] > A[i + 1]:
            UD[i] = -1
        elif A[i] < A[i + 1]:
            UD[i] = 1
        else:
            UD[i] = UD[i - 1]
    UD2 = [0] * N
    for i in range(N):
        if UD[i] > UD[i + 1]:
            UD2[i] = -1
        elif UD[i] < UD[i + 1]:
            UD2[i] = 1
    stock = 0
    money = 1000
    if -1 not in UD2:
        ind = -1
    else:
        ind = (N - 1) - UD2[::-1].index(-1)
    for i in range(N):
        if UD2[i] == -1:
            money += A[i + 1] * stock
            stock = 0
            if i == ind:
                break
        elif UD2[i] == 1:
            stock, money = divmod(money, A[i + 1])
    return money


print((solve()))

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


def sell(money, stock, price):
    money += price * stock
    stock = 0
    return money, stock


def buy(money, price):
    stock, money = divmod(money, price)
    return money, stock


money = 1000
stock = 0
for i in range(N):
    money, stock = sell(money, stock, A[i])
    if i < N - 1 and A[i] < A[i + 1]:
        money, stock = buy(money, A[i])
print(money)

-def solve(): -    ans = 0 -    N = int(eval(input())) -    A = [float("inf")] + list(map(int, input().split())) + [-float("inf")] -    UD = [0] * (N + 1) -    for i in range(N + 1): -        if A[i] > A[i + 1]: -            UD[i] = -1 -        elif A[i] < A[i + 1]: -            UD[i] = 1 -        else: -            UD[i] = UD[i - 1] -    UD2 = [0] * N -    for i in range(N): -        if UD[i] > UD[i + 1]: -            UD2[i] = -1 -        elif UD[i] < UD[i + 1]: -            UD2[i] = 1 -    stock = 0 -    money = 1000 -    if -1 not in UD2: -        ind = -1 -    else: -        ind = (N - 1) - UD2[::-1].index(-1) -    for i in range(N): -        if UD2[i] == -1: -            money += A[i + 1] * stock -            stock = 0 -            if i == ind: -                break -        elif UD2[i] == 1: -            stock, money = divmod(money, A[i + 1]) -    return money +N = int(eval(input())) +A = list(map(int, input().split())) -print((solve())) +def sell(money, stock, price): +    money += price * stock +    stock = 0 +    return money, stock + + +def buy(money, price): +    stock, money = divmod(money, price) +    return money, stock + + +money = 1000 +stock = 0 +for i in range(N): +    money, stock = sell(money, stock, A[i]) +    if i < N - 1 and A[i] < A[i + 1]: +        money, stock = buy(money, A[i]) +print(money)