using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var A = ReadLongs();

            // 連続する株価を除外する
            var pre = A[0];
            var distinct = new List<long>() { A[0] };
            for (int i = 1; i < N; i++)
            {
                if (pre != A[i])
                {
                    distinct.Add(A[i]);
                }
                pre = A[i];
            }

            // 洗い替え
            A = distinct;
            N = distinct.Count;

            var action = new Action[N];
            for (int i = 0; i < N - 1;)
            {
                // 現金が手元にある状態で、より安く株を買えるかどうか
                for (int j = i + 1; j < N; j++)
                {
                    if (A[i] > A[j])
                    {
                        i = j;
                    }
                    if (A[i] < A[j])
                    {
                        break;
                    }
                }

                var hit = false;
                for (int j = i + 1; j < N; j++)
                {
                    if (A[i] < A[j])
                    {
                        // より良いゲインをねらう戦略
                        while (j + 1 < N)
                        {
                            if (A[j] < A[j + 1])
                            {
                                j++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        action[i] = Action.Buy;
                        action[j] = Action.Cell;
                        hit = true;
                        i = j + 1;
                        break;
                    }
                }

                if (!hit) i++;
            }

            var money = 1000L;
            var kabuCount = 0L;
            for (int i = 0; i < N; i++)
            {
                switch (action[i])
                {
                    case Action.Buy:
                        kabuCount = money / A[i];
                        money -= kabuCount * A[i];
                        break;
                    case Action.Cell:
                        money += kabuCount * A[i];
                        kabuCount = 0;
                        break;
                    default:
                        break;
                }
            }
            return money;
        }
        enum Action
        {
            Non = 0,
            Buy = 1,
            Cell = 2,
        }
        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28068