using System.Linq;
using System.Text;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Diagnostics;
using System.Reflection.Metadata;
using System.Threading;

namespace AtCoder
{
    class Program
    {

        struct Point
        {
            public int x;
            public int y;

            public Point(int x, int y)
            {

                this.x = x;
                this.y = y;

            }

        }


        const int BiggestMod = 1000000007;

        public static void Main()
        {

            var num = int.Parse(Console.ReadLine());
            var args = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var cash = new List<int>();
            var stock = 0;

            var start = args.First(x => x != args[0]);
            bool isSellTurn;

            if (start > args[0])
            {
                cash.Add(1000 % args[0]);
                stock = 1000 / args[0];
                isSellTurn = true;
            }
            else
            {
                cash.Add(1000);
                isSellTurn = false;
            }

            for (int i = 1; i + 1 < num; i++)
                if (isSellTurn && args[i] > args[i + 1])
                {

                    cash.Add(cash.Last() + args[i] * stock);
                    isSellTurn = false;

                }
                else if (args[i] < args[i + 1])
                {

                    var buf = cash.Last();
                    cash.Add(buf % args[i]);
                    stock = buf / args[i];
                    isSellTurn = true;

                }

            if (isSellTurn)
                cash.Add(cash.Last() + args[num - 1] * stock);

            Console.WriteLine(cash.Max());

        }

    }

}