#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    def uniq(arr):
        ret = [arr[0]]
        for a in arr[1:]:
            if ret[-1] == a:
                continue
            ret.append(a)
        return ret

    def compress(arr):
        if len(arr) <= 2:
            return arr
        ret = [arr[0]]        
        for a0, a1, a2 in zip(arr, arr[1:], arr[2:]):
            if a0 < a1 < a2 or a0 > a1 > a2:
                continue
            ret.append(a1)
        ret.append(arr[-1])
        return ret

    B = uniq(A)
    C = compress(B)
    ans, m, s = 1000, 1000, 0
    for c0, c1 in zip(C, C[1:]):
        if c0 < c1:
            t = m // c0
            s += t
            m -= t * c0
        else:
            m += c0 * s
            s = 0
        ans = max(ans, m)
    else:
        m += c1 * s
        ans = max(ans, m)
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
