void main()
{
    long[] tmp = readln.split.to!(long[]);
    long n = tmp[0], a = tmp[1], b = tmp[2], c = tmp[3];
    long[] l = new long[n];
    foreach (i; 0 .. n)
    {
        l[i] = readln.chomp.to!long;
    }

    long dfs(long d, long x, long y, long z)
    {
        if (d == n)
        {
            if (min(x, y, z) > 0)
                return abs(x-a) + abs(y-b) + abs(z-c);
            else
                return 10 ^^ 9;
        }

        long result = dfs(d+1, x, y, z);
        result = min(result, dfs(d+1, x+l[d], y, z)+(x?10:0));
        result = min(result, dfs(d+1, x, y+l[d], z)+(y?10:0));
        result = min(result, dfs(d+1, x, y, z+l[d])+(z?10:0));

        return result;
    }

    dfs(0, 0, 0, 0).writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;