using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
    static int Pow(int a,int b)
    {
        if (b == 0)
            return 1;
        else
        {
            if (b % 2 == 0)
            {
                int f = Pow(a, b / 2);
                return f * f;
            }
            else
            {
                int f = Pow(a, (b-1) / 2);
                return f * f *a;
            }
        }
    }

    static Stack<int> base3(int n)
    {
        Stack<int> r = new Stack<int>();
        return base3(n, r);
    }
    static Stack<int> base3(int n,Stack<int> r)
    {
        if (n == 0)
            return r;
        r.Push(n % 4);
        return base3((n - (n % 4)) / 4, r);
    }
    
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int A = int.Parse(str[1]);
        int B = int.Parse(str[2]);
        int C = int.Parse(str[3]);
        int[] l = new int[N];
        for (int i = 0; i < N; i++)
            l[i] = int.Parse(Console.ReadLine());

        int M = int.MaxValue;
        int[] b = new int[N];

        for (int i = 1; i < Pow(4,N); i++)
        {
            int[] L = new int[N];
            var d = base3(i);
            for (int j = d.Count; j > 0; j--)
            {
                L[j - 1] = d.Pop();
            }

            int La = 0, Lb = 0, Lc = 0;
            for (int j = 0; j < N; j++)
            {
                switch (L[j])
                {
                    case 1:
                        La += l[j];
                        break;
                    case 2:
                        Lb += l[j];
                        break;
                    case 3:
                        Lc += l[j];
                        break;
                }
            }
            if (La > 0 && Lb > 0 && Lc > 0)
            {
                if (Math.Abs(La - A) + Math.Abs(Lb - B) + Math.Abs(Lc - C) < M)
                {
                    for (int j = 0; j < N; j++)
                        b[j] = L[j];
                    M = Math.Abs(La - A) + Math.Abs(Lb - B) + Math.Abs(Lc - C);
                }
            }
        }
        Console.WriteLine(10 * (b.Count(x => x == 3) - 1) + 10 * (b.Count(x => x == 1) - 1) + 10 * (b.Count(x => x == 2) - 1) + M);
    }
}