using System;
using System.Linq;
using static System.Console;

public static class Program
{
    static int n;
    static int[] aArray;
    static int maximumMoney = 0;

    static int calcCount = 0;

    public static void Main()
    {
        n = int.Parse(ReadLine());
        aArray = ReadLine().Split(' ').Select(int.Parse).ToArray();


        //何も取引しないときの特殊化
        maximumMoney = 1000;

        int min = 201;
        for(int day = 0; day < n; ++day)
        {
            if(min > aArray[day])
            {
                for(int i = 1; i * aArray[day] <= 1000; ++i)
                {
                    sell(day + 1, 1000 - i * aArray[day], i);
                }
                min = aArray[day];
            }
        }
        WriteLine(maximumMoney);
    }

    static void sell(int currentDay, int money, int stock)
    {
        if (currentDay == n)
        {
            maximumMoney = Math.Max(maximumMoney, money);
            return;
        }
        int max = 0;
        for(int day = currentDay; day < n; ++day)
        {
            if(max < aArray[day])
            {
                for(int i = 1; i <= stock; ++i)
                {
                    buy(day + 1, money + i * aArray[day], stock - i);
                }
                max = aArray[day];
            }
        }
    }

    static void buy(int currentDay, int money, int stock)
    {
        if (currentDay == n)
        {
            maximumMoney = Math.Max(maximumMoney, money);
            return;
        }
        int min = 201;
        for (int day = currentDay; day < n; ++day)
        {
            if (min > aArray[day])
            {
                for (int i = 1; i * aArray[day] <= money; ++i)
                {
                    sell(day + 1, money - i * aArray[day], stock + i);
                }
                min = aArray[day];
            }
        }

    }
}