# m-solutions2020_d.py
# https://atcoder.jp/contests/m-solutions2020 : D

global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    N = int(lines[0])
    # A, B, C = list(map(int, lines[0].split()))
    # K = lines[1]
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    # 利用価値のない変動日を削除する
    difs = list()
    difs.append(values[0])
    prev = None
    for n in range(N-1):
        dif = values[n+1] - values[n]
        if dif == 0:
            pass
        elif prev is None:
            difs.append(values[n+1])
            prev = dif
        elif prev * dif < 0:
            difs.append(values[n+1])
            prev = dif

    log(f'difs=[{difs}]')

    # 初回変動が下がるだけだといらないので削除
    if difs[0] > difs[1]:
        difs = difs[1:]

    # 最終変動が下がるだけだといらないので削除
    if difs[len(difs)-2] > difs[len(difs)-1]:
        difs = difs[:-1]

    log(f'difs=[{difs}]')

    kane = 1000
    kabu = 0

    log(f'len(difs)=[{len(difs)}]')

    if difs == [] or len(difs) == 1:
        return [1000]

    for i, dif in enumerate(difs):
        if i % 2 == 0:
            log(f'kau[{dif}]')
            q, mod = divmod(kane, dif)
            kane -= q*dif
            kabu += q
        else:
            log(f'uru[{dif}]')
            kane += kabu*dif
            kabu = 0

    return [kane]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['7', '100 130 130 130 115 115 150']
        lines_export = [1685]
    if pattern == 2:
        lines_input = ['6', '200 180 160 140 120 100']
        lines_export = [1000]
    if pattern == 3:
        lines_input = ['2', '157 193']
        lines_export = [1216]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        log(f'lines_input=[{lines_input}]')
        log(f'lines_export=[{lines_export}]')
        log(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            log('OK')
        else:
            log('NG')
    finished = time.time()
    duration = finished - started
    log(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()
