@staticmethod
def d():
    (n, *a) = map(int, sys.stdin.read().split())
    a += [(- 1)]
    m = 1000
    s = 0
    for i in range(n):
        if (a[(i + 1)] == a[i]):
            continue
        elif (a[(i + 1)] > a[i]):
            cnt = (m // a[i])
            m -= (a[i] * cnt)
            s += cnt
        else:
            m += (a[i] * s)
            s = 0
    print(m)
@staticmethod
def d():
    (n, *a) = map(int, sys.stdin.read().split())
    a += [(- 1)]
    m = 1000
    s = 0
    for i in range(n):
        if (a[(i + 1)] == a[i]):
            continue
        elif (a[(i + 1)] > a[i]):
            cnt = (m // a[i])
            m -= (a[i] * cnt)
            s += cnt
        else:
            m += (a[i] * s)
            s = 0
    print(m)