using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    
    class Solve
    {
        const int mod = 1000000007;
        static int N, A, B, C;
        static int[] l;

        const int INF = 1000000000;
        
        public static void Input()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            N = input[0];
            A = input[1];
            B = input[2];
            C = input[3];
            l = new int[N];
            for(var i = 0; i < N; i++)
            {
                l[i] = int.Parse(Console.ReadLine());
            }
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            
            Console.WriteLine(Dfs(0, 0, 0, 0));

            //Console.Out.Flush();

            long Dfs(int cur, int a, int b, int c)//使用本数、aの竹、bの竹、cの竹の長さ
            {
                if (cur == N)
                {
                    return Math.Min(a, Math.Min(b, c)) > 0 ? Math.Abs(a - A) + Math.Abs(b - B) + Math.Abs(c - C) - 30 : INF;//1本目として選んだ時にも１０消費しているので引く
                }
                else
                {
                    long r0 = Dfs(cur + 1, a, b, c);
                    long r1 = Dfs(cur + 1, a + l[cur], b, c) + 10;
                    long r2 = Dfs(cur + 1, a, b + l[cur], c) + 10;
                    long r3 = Dfs(cur + 1, a, b, c + l[cur]) + 10;
                    return Math.Min(Math.Min(r0, r1), Math.Min(r2, r3));
                }
            }

        }

        
    }

    
}

