def main():



    n = int(eval(input()))

    A = list(map(int, input().split()))

    INF = 19**18



    X = []

    Y = []

    A = [INF] + A

    for i in range(1, n):

        if len(X) == len(Y):

            if A[i-1] >= A[i] and A[i] < A[i+1]:

                X.append(i)

        if len(X) > len(Y):

            if  A[i-1] <= A[i] and A[i] > A[i+1]:

                Y.append(i)

    else:

        if len(X) > len(Y):

            Y.append(i+1)

    #print(X)

    #print(Y)



    cur = 1000

    for i, j in zip(X, Y):

        q, cur = divmod(cur, A[i])

        cur += q*A[j]

    print(cur)







if __name__ == '__main__':

    main()

n = int(eval(input()))

A = list(map(int, input().split()))



x = 1000

for i in range(n-1):

    if A[i] < A[i+1]:

        q, x = divmod(x, A[i])

        x += q*A[i+1]

print(x)
def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    INF = 19**18
    X = []
    Y = []
    A = [INF] + A
    for i in range(1, n):
        if len(X) == len(Y):
            if A[i - 1] >= A[i] and A[i] < A[i + 1]:
                X.append(i)
        if len(X) > len(Y):
            if A[i - 1] <= A[i] and A[i] > A[i + 1]:
                Y.append(i)
    else:
        if len(X) > len(Y):
            Y.append(i + 1)
    # print(X)
    # print(Y)
    cur = 1000
    for i, j in zip(X, Y):
        q, cur = divmod(cur, A[i])
        cur += q * A[j]
    print(cur)


if __name__ == "__main__":
    main()

n = int(eval(input()))
A = list(map(int, input().split()))
x = 1000
for i in range(n - 1):
    if A[i] < A[i + 1]:
        q, x = divmod(x, A[i])
        x += q * A[i + 1]
print(x)

-def main(): -    n = int(eval(input())) -    A = list(map(int, input().split())) -    INF = 19**18 -    X = [] -    Y = [] -    A = [INF] + A -    for i in range(1, n): -        if len(X) == len(Y): -            if A[i - 1] >= A[i] and A[i] < A[i + 1]: -                X.append(i) -        if len(X) > len(Y): -            if A[i - 1] <= A[i] and A[i] > A[i + 1]: -                Y.append(i) -    else: -        if len(X) > len(Y): -            Y.append(i + 1) -    # print(X) -    # print(Y) -    cur = 1000 -    for i, j in zip(X, Y): -        q, cur = divmod(cur, A[i]) -        cur += q * A[j] -    print(cur) - - -if __name__ == "__main__": -    main() +n = int(eval(input())) +A = list(map(int, input().split())) +x = 1000 +for i in range(n - 1): +    if A[i] < A[i + 1]: +        q, x = divmod(x, A[i]) +        x += q * A[i + 1] +print(x)