import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n, a, b, c;
    scan(n, a, b, c);
    auto x = iota(n).map!(i => readln.chomp.to!int).array;

    long ans = inf6;

    foreach (s ; 1 .. 1 << n) {
        long tmp;

        int la;
        foreach (j ; 0 .. n) {
            if (s & (1 << j)) {
                la += x[j];
                tmp += 10;
            }
        }
        tmp -= 10;

        foreach (t ; 1 .. 1 << n) {
            auto ttmp = tmp;
            int lb;
            if (s & t) continue;
            foreach (k ; 0 .. n) {
                if (t & (1 << k)) {
                    lb += x[k];
                    ttmp += 10;
                }
            }
            ttmp -= 10;

            foreach (u ; 1 .. 1 << n) {
                if ((s | t) & u) continue;
                auto tttmp = ttmp;
                int lc;
                foreach (e ; 0 .. n) {
                    if (u & (1 << e)) {
                        lc += x[e];
                        tttmp += 10;
                    }
                }
                tttmp -= 10;
                tttmp += abs(la - a) + abs(lb - b) + abs(lc - c);
                ans = min(ans, tttmp);
            }
        }
    }

    writeln(ans);
}




int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {writeln(b ? "Yes" : "No");}
void YES(bool b) {writeln(b ? "YES" : "NO");}
T[] readArr(T)() {return readln.split.to!(T[]);}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
