import copy
from collections import deque


# def fig(A):
#     x = np.array(range(len(A)))
#     y = np.array(A)
#     plt.plot(x, y)
#     plt.show()


def buy(money, A, stock):
    stock += money // A
    money %= A
    return money, stock


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


def do_both(money, A0, A1, stock):
    money, stock = buy(money, A0, stock)
    money, stock = sell(money, A1, stock)
    return (money, stock)


def shaping(A):
    # 連続値を削除
    B = A[:1]
    for a in A[1:]:
        if B[-1] != a:
            B.append(a)
    # 上昇あるいは下降の途中値を削除
    A = copy.copy(B)
    B = A[:1]
    for i in range(1, len(A)-1):
        if not (A[i-1] < A[i] < A[i+1] or A[i-1] > A[i] > A[i+1]):
            B.append(A[i])
    B.append(A[-1])
    # 最初と最後を調整
    A = copy.copy(B)
    #   最初よりその次のほうが低ければ、その次を開始地点とする
    try:
        if A[1] < A[0]:
            A = A[1:]
    except:
        pass
    #   最後よりその前のほうが高ければ、その前を終了地点とする
    try:
        if A[-2] > A[-1]:
            A = A[:-1]
    except:
        pass
    # (下, 上)のタプルに変換して返す
    return [(A[i], A[i+1]) for i in range(0, len(A)-1, 2)]


def bfs(q, A, i):
    if i >= len(A):
        return q
    money, stock = q.popleft()
    q.append(do_both(money, *A[i], 0))
    q.append((money, stock))
    return bfs(q, A, i+1)


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    A = shaping(A)
    q = deque()
    if len(A) == 0:
        print(1000)
        exit()
    q.append(do_both(1000, *A[0], 0))
    q.append((1000, 0))
    q = bfs(q, A, 1)

    ans = 0
    for a in q:
        if a[0] >= ans:
            ans = a[0]

    print(ans)
