using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC119_C
{
    class Program
    {
        class BambooData
        {
            public int[] Count = new int[3];
            public int[] Length = new int[3];
            public int ExtraCost;

            public BambooData()
            {
            }

            public BambooData(BambooData bambooData)
            {
                for (int i = 0; i < 3; ++i)
                {
                    Count[i] = bambooData.Count[i];
                    Length[i] = bambooData.Length[i];
                }
                ExtraCost = bambooData.ExtraCost;
            }
        }

        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');
            int n = int.Parse(strs[0]);

            int[] abc = new int[3];
            abc[0] = int.Parse(strs[1]);
            abc[1] = int.Parse(strs[2]);
            abc[2] = int.Parse(strs[3]);

            int[] l = new int[n];

            for (int i = 0; i < n; ++i)
            {
                l[i] = int.Parse(Console.ReadLine());
            }

            int bambooDataIndex = 0;

            BambooData[] bambooData = new BambooData[65536];
            BambooData bambooData_ = new BambooData();

            int minDiff = int.MaxValue;
            int minDiffIndex = 0;

            AddBamboo(bambooData_, 0, n, ref bambooDataIndex, ref minDiff, ref minDiffIndex, l, bambooData, abc);

            Console.WriteLine("{0}", minDiff);
        }

        static void AddBamboo_(BambooData _bambooData, int bambooCountR, int maxBamboo, int addBambooIndex, ref int dataIndex, ref int minDiff, ref int minDiffIndex, int[] bambooLengthAll, BambooData[] bambooResults, int[] abc)
        {
            BambooData bambooData = new BambooData(_bambooData);

            if (addBambooIndex < 3)
            {
                bambooData.Length[addBambooIndex] += bambooLengthAll[bambooCountR];
                if (bambooData.Count[addBambooIndex] != 0)
                {
                    bambooData.ExtraCost += 10;
                }

                ++bambooData.Count[addBambooIndex];

                if (bambooData.Count[0] >= 1 &&
                    bambooData.Count[1] >= 1 &&
                    bambooData.Count[2] >= 1)
                {
                    int diff = Math.Abs(bambooData.Length[0] - abc[0]) +
                               Math.Abs(bambooData.Length[1] - abc[1]) +
                               Math.Abs(bambooData.Length[2] - abc[2]) + bambooData.ExtraCost;

                    if (minDiff > diff)
                    {
                        minDiff = diff;
                        minDiffIndex = dataIndex;
                    }

                    bambooResults[dataIndex] = bambooData;
                    ++dataIndex;
                }
            }

            ++bambooCountR;

            if (bambooCountR >= maxBamboo)
            {
                return;
            }

            AddBamboo(bambooData, bambooCountR, maxBamboo, ref dataIndex, ref minDiff, ref minDiffIndex, bambooLengthAll, bambooResults, abc);
        }

        static BambooData AddBamboo(BambooData bambooData, int bambooCountR, int maxBamboo, ref int dataIndex, ref int minDiff, ref int minDiffIndex, int[] bambooLengthAll, BambooData[] bambooResults, int[] abc)
        {
            for (int i = 0; i < 4; ++i)
            {
                AddBamboo_(bambooData, bambooCountR, maxBamboo, i, ref dataIndex, ref minDiff, ref minDiffIndex, bambooLengthAll, bambooResults, abc);
            }

            return bambooData;
        }

    }
}


Measured memory_bytes: 24520