#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var sw = new Stopwatch();
        
        // true is base , false is gousei, null is not use
        var nabc =
             Console.ReadLine().SplittedStringToInt32List();
        var n = nabc[0];
        var a = nabc[1];
        var b = nabc[2];
        var c = nabc[3];
        
        

        var lnls = new List<int>();

        for (int i = 0; i < n; i++)
        {
            var ln = Console.ReadLine().ToInt32();
            lnls.Add(ln);
        }
        sw.Start();
        var bits = CreateBits(n);
        var abcs = new List<int>() { a, b, c };
        var minmp = double.MaxValue;
        foreach (var item in bits)
        {
            if (item.Count(x => x == true) != 3)
            {
                continue;
            }
            var count = 0;
            var based = new List<int>();
            foreach (var ii in item)
            {
                if (ii == true)
                    based.Add(lnls[count]);
                count++;
            }
            var basedbase = based.ToList();
            var sythe = new List<int>();
            count = 0;
            foreach (var ii in item)
            {
                if (ii == false)
                {
                    sythe.Add(lnls[count]);
                }
                count++;
            }
            // true is 0, false is 1, null is 2
            var bits2 = CreateBits(sythe.Count);
            var usedmp = sythe.Count * 10;
            var minmagic2power = double.MaxValue;
            if (bits2.Count == 0)
            {
                // first
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {

                        // second
                        for (int k = 0; k < 3; k++)
                        {
                            for (int l = 0; l < 3; l++)
                            {
                                if (i == k || j == l)
                                {
                                    continue;
                                }
                                // third
                                for (int m = 0; m < 3; m++)
                                {
                                    for (int nn = 0; nn < 3; nn++)
                                    {

                                        if (i == m || k == m || j == nn || l == nn)
                                        {
                                            continue;
                                        }
                                        var sums = Math.Abs(based[i] - abcs[j]) + Math.Abs(based[k] - abcs[l]) + Math.Abs(based[m] - abcs[nn]);
                                        if (sums < minmagic2power)
                                        {
                                            minmagic2power = sums;
                                        }

                                    }

                                }
                            }
                        }
                    }
                }
            }

            else
            {
                foreach (var ii in bits2)
                {
                    based = basedbase.ToList();
                    var ind = 0;
                    foreach (var bbb in ii)
                    {

                        if (bbb == true)
                        {
                            based[0] += sythe[ind];
                        }
                        else if (bbb == false)
                        {
                            based[1] += sythe[ind];

                        }
                        else
                        {
                            based[2] += sythe[ind];
                        }
                        ind++;

                    }
                    // first
                    for (int i = 0; i < 3; i++)
                    {
                        for (int j = 0; j < 3; j++)
                        {

                            // second
                            for (int k = 0; k < 3; k++)
                            {
                                for (int l = 0; l < 3; l++)
                                {
                                    if (i == k || j == l)
                                    {
                                        continue;
                                    }
                                    // third
                                    for (int m = 0; m < 3; m++)
                                    {
                                        for (int nn = 0; nn < 3; nn++)
                                        {

                                            if (i == m || k == m || j == nn || l == nn)
                                            {
                                                continue;
                                            }
                                            var sums = Math.Abs(based[i] - abcs[j]) + Math.Abs(based[k] - abcs[l]) + Math.Abs(based[m] - abcs[nn]);
                                            if (sums < minmagic2power)
                                            {
                                                minmagic2power = sums;
                                            }

                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }

            minmp = Math.Min(minmagic2power + usedmp, minmp);
        }
        Console.WriteLine(minmp);
        sw.Stop();
        Console.ReadLine();
    }

    
    public static long Sums(IEnumerable<int> list)
    {
        var sum = 0l;
        foreach (var item in list)
        {
            sum += item;
        }
        return sum;
    }

    public static long f(long n,long b)
    {
        if (n < b)
        {
            return n;
        }
        else
        {
            return f((long)Math.Floor((double)n/b),b) + n % b;
        }
    }

    public static string N(long n,long b)
    {
        var sb = new StringBuilder();
        while (true)
        {
            sb.Append((n % b).ToString());
            n /= b;
            if (n < b)
            {
                sb.Append(n.ToString());
                break;
            }
        }
        return new string( sb.ToString().Reverse().ToArray() );
    }

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;
    public const int Mod1e9 = 1000000007;



    public static List<List<bool>> CreateBits2(int len)
    {
        return CreateBitsPri2(new List<List<bool>>(), len, 0);
    }

    private static List<List<bool>> CreateBitsPri2(List<List<bool>> bits, int len, int count)
    {
        if (count == 0)
        {
            var lss = new List<bool>();
            lss.Add(true);
            bits.Add(lss);
            var lx = new List<bool>();
            lx.Add(false);
            bits.Add(lx);
            count++;
            return CreateBitsPri2(bits, len, count);
        }
        if (len - count == 0)
            return bits;
        count++;
        var ls = new List<List<bool>>();
        foreach (var item in bits)
        {
            var x = item.ToList();
            var y = item.ToList();
            x.Add(true);
            y.Add(false);
            ls.Add(y);
            ls.Add(x);
        }
        return CreateBitsPri2(ls, len, count);
    }

    public static void PrintArray(bool[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion


    public static List<List<bool?>> CreateBits(int len)
    {

        return CreateBitsPri(new List<List<bool?>>(), len, 0);
    }

    private static List<List<bool?>> CreateBitsPri(List<List<bool?>> bits, int len, int count)
    {
        if (len == 0)
        {
            return new List<List<bool?>>();
        }
        if (count == 0)
        {
            var lss = new List<bool?>();
            lss.Add(true);
            bits.Add(lss);
            var lx = new List<bool?>();
            lx.Add(false);
            bits.Add(lx);
            var ll = new List<bool?>();
            ll.Add(null);
            bits.Add(ll);
            count++;
            return CreateBitsPri(bits, len, count);
        }
        if (len - count == 0)
            return bits;
        count++;
        var ls = new List<List<bool?>>();
        foreach (var item in bits)
        {
            var x = item.ToList();
            var zz = item.ToList();
            x.Add(true);
            zz.Add(false);
            ls.Add(zz);
            ls.Add(x);
            var yy = item.ToList();
            yy.Add(null);
            ls.Add(yy);
        }
        return CreateBitsPri(ls, len, count);
    }
}



Measured memory_bytes: 20940