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

namespace ABC119_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var sss = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var N = sss[0];
            var A = sss[1];
            var B = sss[2];
            var C = sss[3];
            var bamb = new int[N];
            for (var i = 0; i < N; i++)
            {
                bamb[i] = int.Parse(Console.ReadLine());
            }
            var mp = dfs(0, 0, 0, 0, bamb, N, A, B, C);
            Console.WriteLine(mp);
        }
        static int dfs(int depth, int a, int b, int c, int[] bamb, int N, int A, int B, int C)
        {
            if (depth == N)
            {
                if (a < 0 && b < 0 && c < 0)
                {
                    return int.MaxValue;
                }
                var mp = Math.Abs(A - a) + Math.Abs(B - b) + Math.Abs(C - c) - 30;
                return mp;
            }
            var result1 = dfs(depth + 1, a, b, c, bamb, N, A, B, C);
            var result2 = dfs(depth + 1, a + bamb[depth], b, c, bamb, N, A, B, C) + 10;
            var result3 = dfs(depth + 1, a, b + bamb[depth], c, bamb, N, A, B, C) + 10;
            var result4 = dfs(depth + 1, a, b, c + bamb[depth], bamb, N, A, B, C) + 10;

            var result = Math.Min(result1, result2);
            result = Math.Min(result, result3);
            result = Math.Min(result, result4);
            return result;
        }
    }
}
