#include <cstdio>
#include <vector>
#include <algorithm>

#define INF 1000000000

using namespace std;

int n, a, b, c;
vector<int> l;

int dfs(int st, int ca, int cb, int cc) {
    if (st == n) return (ca && cb && cc ? abs(a - ca) + abs(b - cb) + abs(c - cc) : INF);
    return min({dfs(st + 1, ca, cb, cc), dfs(st + 1, ca + l.at(st), cb, cc) + 10, dfs(st + 1, ca, cb + l.at(st), cc) + 10, dfs(st + 1, ca, cb, cc + l.at(st)) + 10});
}

int main() {
    scanf("%d%d%d%d", &n, &a, &b, &c);
    l.resize(n);
    for (int i = 0; i < n; ++i) scanf("%d", l.begin() + i);
    printf("%d\n", dfs(0, 0, 0, 0) - 10 * 3);
    return 0;
}
