import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



N = int(eval(input()))

As = list(mapint())



memo = {}

s = set()



ans = 0

def dfs(idx, money, stocks):

    global ans

    if idx==N:

        ans = max(ans, money)

        return

    a = As[idx]

    if (idx, stocks) in s:

        if money<=memo[(idx, stocks)]:

            return

    s.add((idx, stocks))

    memo[(idx, stocks)] = money

    dfs(idx+1, money+stocks*a, 0)

    dfs(idx+1, money, stocks)

    cnt = money//a

    dfs(idx+1, money-cnt*a, stocks+cnt)



dfs(0, 1000, 0)

print(ans)
import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



N = int(eval(input()))

As = list(mapint())

money = 1000

for i in range(1, N):

    if As[i]>As[i-1]:

        money += (money//As[i-1])*(As[i]-As[i-1])

print(money)
import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = list(mapint())
memo = {}
s = set()
ans = 0


def dfs(idx, money, stocks):
    global ans
    if idx == N:
        ans = max(ans, money)
        return
    a = As[idx]
    if (idx, stocks) in s:
        if money <= memo[(idx, stocks)]:
            return
    s.add((idx, stocks))
    memo[(idx, stocks)] = money
    dfs(idx + 1, money + stocks * a, 0)
    dfs(idx + 1, money, stocks)
    cnt = money // a
    dfs(idx + 1, money - cnt * a, stocks + cnt)


dfs(0, 1000, 0)
print(ans)

import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = list(mapint())
money = 1000
for i in range(1, N):
    if As[i] > As[i - 1]:
        money += (money // As[i - 1]) * (As[i] - As[i - 1])
print(money)

-memo = {} -s = set() -ans = 0 - - -def dfs(idx, money, stocks): -    global ans -    if idx == N: -        ans = max(ans, money) -        return -    a = As[idx] -    if (idx, stocks) in s: -        if money <= memo[(idx, stocks)]: -            return -    s.add((idx, stocks)) -    memo[(idx, stocks)] = money -    dfs(idx + 1, money + stocks * a, 0) -    dfs(idx + 1, money, stocks) -    cnt = money // a -    dfs(idx + 1, money - cnt * a, stocks + cnt) - - -dfs(0, 1000, 0) -print(ans) +money = 1000 +for i in range(1, N): +    if As[i] > As[i - 1]: +        money += (money // As[i - 1]) * (As[i] - As[i - 1]) +print(money)