using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = CinT();
            var A = CinTAr();
            var Q = new List<int>() { A[0] };
            bool preupper = false;
            for(int i = 1;i < N; i++)
            {
                if(A[i - 1] != A[i])
                {
                    if (i > 1)
                    {
                        bool q = A[i - 1] < A[i];
                        if (q == preupper)
                        {
                            Q.RemoveAt(Q.Count - 1);
                        }
                        else
                        {
                            preupper = q;
                        }

                    }
                    else
                    {
                        preupper = A[0] < A[1];
                    }
                    Q.Add(A[i]);
                }
            }
            N = Q.Count;
            A = Q.ToArray();
            Queue<int> downi = new Queue<int>();
            downi.Enqueue(0);
            Queue<int> upi = new Queue<int>();
            for(int i = 1;i < N; i++)
            {
                if(A[i - 1] < A[i])
                {
                    upi.Enqueue(i);
                }
                else if(A[i - 1] > A[i])
                {
                    downi.Enqueue(i);
                }
            }
            //CoutAr(A);
            //CoutAr(downi);
            //CoutAr(upi);
            long money = 1000;
            long stock = 0;
            long next_up_i = (upi.Count > 0) ? upi.Dequeue() : -1;
            long next_down_i = (downi.Count > 0) ? downi.Dequeue() : -1;
            for (int i = 0; i < N; i++)
            {
                //Cout(next_up_i);
                //Cout(next_down_i);
                if ((next_up_i > next_down_i) && next_down_i != -1)
                {
                    //buy timing
                    int m = A[i];
                    //Cout("buy : " + i);
                    while (money - m >= 0)
                    {
                        stock++;
                        money -= m;
                    }
                }
                if ((next_down_i > next_up_i || next_down_i == -1) && next_up_i != -1)
                {
                    //Cout("sale : " + i);
                    //sale timing
                    money += stock * A[i];
                    stock = 0;
                }
                if (i == next_down_i)
                {
                    next_down_i = (downi.Count > 0) ? downi.Dequeue() : -1;
                }
                if (i == next_up_i)
                {
                    next_up_i = (upi.Count > 0) ? upi.Dequeue() : -1;
                }
            }

            Cout(money);
            Cin();
        } //main



        static readonly int MOD10_9_7 = (1000000000 + 7);
        static Random Rand = new Random();
        static readonly string[] AlphabetTable = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
        static int GetDigits(long num) { return (int)Floor(Log10(num)) + 1; }
        static int GetNumByDigit(long num, int digit)
        {
            return (int)((num / ((int)Pow(10, digit - 1))) % 10);
        }
        static int Loop(int num, int max)
        {
            if (num > max) { return num % max - 1; }
            else if (num < 0) { return max - (-num) % max + 1; }
            else { return num; }
        }
        static long PW10(int n) { return (long)Pow(10, n); }
        static long GCD(long a, long b)
        {
            if (a < b) { return GCD(b, a); }
            if (a % b == 0) { return b; }
            else { return GCD(b, a % b); }
        }
        static long LCM(long a, long b) { return a * b / GCD(a, b); }
        static void Swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
        static void SwapArE<T>(T[] a, int i, int j) { T t = a[i]; a[i] = a[j]; a[j] = t; }
        static void SwapLiE<T>(List<T> a, int i, int j) { T t = a[i]; a[i] = a[j]; a[j] = t; }
        static bool IsInt(double d) { return (int)d == d; }
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { var q = Cin().Split(' '); return (q[0] == "") ? new string[0] : q; }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void Cout(object s) { WriteLine(s); }
        static string RevStr(string s) { return new string(s.Reverse().ToArray()); }
        static long[] Divisor(long n)
        {
            if (n == 1) { return new long[] { 1 }; }
            List<long> res = new List<long>() { 1, n };
            for (long i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    res.Add(i);
                    long f = n / i;
                    if (f != i) { res.Add(f); }
                }
            }
            return res.ToArray();
        }
        static IEnumerable<decimal> PrimeFactors(decimal n)
        {
            decimal i = 2, tmp = n;
            while (i * i <= n)
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else { i++; }
            }
            if (tmp != 1) { yield return tmp; }
        }
        static bool IsPrime(long num)
        {
            if (num == 1) { return false; }
            for (long i = 2; i <= Sqrt(num) + 1; i++) { if (num % i == 0) { return false; } }
            return true;
        }
        static void CoutAr<Type>(IEnumerable<Type> types) { Cout(string.Join(" ", types)); }
        static long nCr(int n, int r) { return nPr(n, r) / Factorial(r); }
        static long nPr(int n, int r) { return FactorialDivision(n, n - r); }
        static long FactorialDivision(int tf, int df)
        {
            long r = 1;
            for (int i = tf; i > df; i--) { r *= i; }
            return r;
        }
        static long Factorial(int i)
        {
            if (i <= 1) { return 1; }
            return i * Factorial(i - 1);
        }
        static void CoutMemPairAr<Type>(IEnumerable<Pair<Type>> pairs)
        {
            var ar = pairs.ToArray();
            for (int i = 0; i < ar.Length; i++) { Write($"({ar[i].a}, {ar[i].b}, {ar[i].c}), "); }
            Cout("");
        }
    }
    public struct Pair<T>
    {
        public T a, b, c;
        public Pair(T _a, T _b, T _c = default(T)) { a = _a; b = _b; c = _c; }
    }
}
