using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = NextInt();
        int A = NextInt();
        int B = NextInt();
        int C = NextInt();
        List<int> l = new List<int>();
        for (int i = 0; i < N; i++) { l.Add(NextInt()); }
        l.Sort();
        int ans = INF;
        //ABC
        List<int> t_l = new List<int>(l);
        int t_ans = 0;
        t_ans += Solve(A, ref t_l);
        //t_l.ForEach(v => Console.Write(" " + v));
        //Console.WriteLine(t_ans);
        t_ans += Solve(B, ref t_l);
        //t_l.ForEach(v => Console.Write(" " + v));
        //Console.WriteLine(t_ans);
        t_ans += Solve(C, ref t_l);
        //Console.WriteLine(t_ans);
        ans = Math.Min(ans, t_ans);

        //ACB
        t_l = new List<int>(l);
        t_ans = 0;
        t_ans += Solve(A, ref t_l);
        t_ans += Solve(C, ref t_l);
        t_ans += Solve(B, ref t_l);
        ans = Math.Min(ans, t_ans);

        //BAC
        t_l = new List<int>(l);
        t_ans = 0;
        t_ans += Solve(B, ref t_l);
        t_ans += Solve(A, ref t_l);
        t_ans += Solve(C, ref t_l);
        ans = Math.Min(ans, t_ans);

        //BCA
        t_l = new List<int>(l);
        t_ans = 0;
        t_ans += Solve(B, ref t_l);
        t_ans += Solve(C, ref t_l);
        t_ans += Solve(A, ref t_l);
        ans = Math.Min(ans, t_ans);

        //CAB
        t_l = new List<int>(l);
        t_ans = 0;
        t_ans += Solve(C, ref t_l);
        t_ans += Solve(A, ref t_l);
        t_ans += Solve(B, ref t_l);
        ans = Math.Min(ans, t_ans);

        //CBA
        t_l = new List<int>(l);
        t_ans = 0;
        t_ans += Solve(C, ref t_l);
        t_ans += Solve(B, ref t_l);
        t_ans += Solve(A, ref t_l);
        ans = Math.Min(ans, t_ans);

        Console.WriteLine(ans);
    }

    static int Solve(int X, ref List<int> l)
    {
        int N = l.Count();
        //bit全探索
        //1が立つもので結合を行い、他全てを伸ばすor知事メル
        int M = (int)Math.Pow(2, N);
        int min_c = INF;
        List<int> min_ed = new List<int>();
        for (int bit = 1; bit < M; bit++)
        {
            int cost = -10;
            int leng = 0;
            List<int> ed = new List<int>();
            for (int shift = 0; shift < N; shift++)
            {
                if ((1 & bit >> shift) == 1)
                {
                    //1が立つ処理
                    leng += l[shift];
                    cost += 10;
                    ed.Add(l[shift]);
                }
            }
            cost += Math.Abs(X - leng);
            if (min_c > cost)
            {
                min_c = cost;
                min_ed = ed;
            }
        }
        foreach (var e in min_ed) { l.Remove(e); }
        return min_c;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 13396