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

namespace Competitive
{
    internal class Solution
    {
        public int N, A, B, C;
        public int[] L;
        public long MOD = 1000000007;
        public int Ret;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                A = line[1];
                B = line[2];
                C = line[3];
            }

            L = new int[N];
            for (int i = 0; i < N; i++)
            {
                L[i] = Input.ReadInt();
            }

            Ret = int.MaxValue;
            var bf = new BruteForceBit(N, Process);

            bf.DFSRun();

            Console.WriteLine(Ret);

        }

        public void Process(int[] ary)
        {
            int ret = 0;
            int a = 0, b = 0, c = 0;
            int ac = 0, bc = 0, cc = 0;
            for (int i = 0; i < N; i++)
            {
                if (ary[i] == 1)
                {
                    a += L[i];
                    ac++;
                }

                if (ary[i] == 2)
                {
                    b += L[i];
                    bc++;
                }

                if (ary[i] == 3)
                {
                    c += L[i];
                    cc ++;
                }
            }

            ret += Math.Abs(a - A);
            ret += Math.Abs(b - B);
            ret += Math.Abs(c - C);
            ret += 10 * (ac - 1 + bc - 1 + cc - 1);
            // Console.Error.WriteLine($"{a}, {b}, {c}");

            if(ac > 0 && bc > 0 && cc > 0) Ret = Math.Min(Ret, ret);
        }
    }

    // libs ----------
    // 0/1ビット列を全通り列挙
    class BruteForceBit
    {
        public int N;
        public int[] F;
        private Action<int[]> Process;

        public BruteForceBit(int N, Action<int[]> process)
        {
            this.N = N;
            F = new int[N];
            Process = process;
        }

        public void DFSRun()
        {
            DFS(0);
        }

        private void DFS(int i)
        {
            if (i == N)
            {
                Process(F);
            }
            else
            {
                F[i] = 0;
                DFS(i + 1);
                F[i] = 1;
                DFS(i + 1);
                F[i] = 2;
                DFS(i + 1);
                F[i] = 3;
                DFS(i + 1);
            }
        }

    }

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396