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


class Program
{
    public static int n;
    public static int a;
    public static int b;
    public static int c;
    public static int[] l;

    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] 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());
        }


        var ans = dfs(0, 0, 0, 0);

        // 出力
        Console.WriteLine(ans);
    }

    static int dfs(int cur, int x, int y, int z)
    {
        if (cur == n)
        {
            if (x == 0 || y == 0 || z == 0)
            {
                return int.MaxValue;
            }
            else
            {
                return Math.Abs(x - a) + Math.Abs(y - b) + Math.Abs(z - c) - 30;
            }
        }
        else
        {
            int ret0 = dfs(cur + 1, x, y, z);
            int ret1 = dfs(cur + 1, x + l[cur], y, z) + 10;
            int ret2 = dfs(cur + 1, x, y + l[cur], z) + 10;
            int ret3 = dfs(cur + 1, x, y, z + l[cur]) + 10;

            var tmp = Math.Min(ret0, ret1);
            tmp = Math.Min(tmp, ret2);
            tmp = Math.Min(tmp, ret3);
            return tmp;
        }
    }
}