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

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static int[] ToInt(this string[] strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ToLong(this string[] strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] SpInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long[] SpLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int Diff(int a, int b) => (int)Diff(a, (long)b);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Sign(this int i) => Math.Sign(i);
    public static bool IsEven(this int i) => i % 2 == 0;
    public static int[] dx = new int[] { 0, -1, 0, 1 };
    public static int[] dy = new int[] { -1, 0, 1, 0 };
    public static int Gcd(int a, int b) => (int)Gcd(a, (long)b);
    public static long Gcd(long a, long b)
    {
        if (b == 0)
        {
            return a;
        }

        return Gcd(b, a % b);
    }                       //最大公約数
    public static int Lcm(int a, int b) => (int)Lcm(a, (long)b);
    public static long Lcm(long a, long b) => a / Gcd(a, b) * b;    //最小公倍数
    public static void Swap(ref object a, ref object b)
    {
        var temp = a;
        b = a;
        a = temp;
    }
    //テンプレここまで
}

public static partial class Program
{
    public static void Main()
    {
        var nabc = CRL().SpInts();
        N = nabc[0];
        A = nabc[1];
        B = nabc[2];
        C = nabc[3];
        banboos = new List<int>();
        for (int i = 0; i < nabc[0]; i++)
        {
            banboos.Add(CRL().ToInt());
        }

        CWL(DFS(0, 0, 0, 0));
    }

    public static long N { get; private set; }
    public static long A { get; private set; }
    public static long B { get; private set; }
    public static long C { get; private set; }
    private static List<int> banboos;

    public static long DFS(int cur, long a, long b, long c)
    {
        if (cur == N)
        {
            if (new[] { a, b, c }.Min() < 0)
            {
                return long.MaxValue;
            }
            else
            {
                return Math.Abs(a - A) + Math.Abs(b - B) + Math.Abs(c - C) - 30;
            }
        }

        var ret0 = DFS(cur + 1, a, b, c);                       //その竹を使わない時
        var ret1 = DFS(cur + 1, a + banboos[cur], b, c) + 10;   //
        var ret2 = DFS(cur + 1, a, b + banboos[cur], c) + 10;
        var ret3 = DFS(cur + 1, a, b, c + banboos[cur]) + 10;
        return new[] { ret0, ret1, ret2, ret3 }.Min();
    }
}
