using System;
using System.Linq;

namespace ABC119_C
{
    class Program
    {
        static int A, B, C, N;
        static int[] l;
        static void Main(string[] args)
        {
            var NABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            N = NABC[0];
            A = NABC[1];
            B = NABC[2];
            C = NABC[3];

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

            Console.WriteLine(Calc(0, 0, 0, 0));
        }

        static int Calc(int cnt, int a, int b, int c)
        {
            if (cnt == N) return a + b + c == 0 ? int.MaxValue : Math.Abs(A - a) + Math.Abs(B - b) + Math.Abs(C - c) - 30;

            var pattern = new int[4];
            pattern[0] = Calc(cnt + 1, a, b, c);
            pattern[2] = Calc(cnt + 1, a + l[cnt], b, c) + 10;
            pattern[1] = Calc(cnt + 1, a, b + l[cnt], c) + 10;
            pattern[3] = Calc(cnt + 1, a, b, c + l[cnt]) + 10;

            return pattern.Min();
        }
    }
}
