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();
        Calculate(0, 1000, 0);
        WriteLine(maximumMoney);
        WriteLine(calcCount);
    }

    static void Calculate(int currentDay, int money, int stock)
    {
        calcCount++;
        if(currentDay == n - 1)
        {
            //最終日は株を売り払う
            if (maximumMoney < money + stock * aArray[currentDay]) 
                maximumMoney = money + stock * aArray[currentDay];
        }
        else
        {
            //もし前日と同じ価格ならスルー
            if(currentDay != 0 && aArray[currentDay] == aArray[currentDay - 1])
            {
                Calculate(currentDay + 1, money, stock);
            }
            else
            {
                //株買い、ないし取引なし
                for (int k = 0; k * aArray[currentDay] <= money; ++k)
                {
                    Calculate(currentDay + 1, money - k * aArray[currentDay], stock + k);
                }
                //株売
                for (int k = 1; k <= stock; ++k)
                {
                    Calculate(currentDay + 1, money + k * aArray[currentDay], stock - k);
                }
            }
        }
    }
}