#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, A, B, C; cin >> N >> A >> B >> C;
    vector<int> L(N); for (int &l : L) cin >> l;
    int ans = numeric_limits<int>::max();
    for (int i = 0, e = pow(4, N); i < e; i++) {
        int a[3] = {}, cost = 0, k = i;
        for (int j = 0; j < N; j++, k /= 4) {
            if (k % 4 == 3) continue;
            if (a[k % 4] != 0) cost += 10;
            a[k % 4] += L[j];
        }
        if (a[0] == 0 || a[1] == 0 || a[2] == 0) continue;
        ans = min(ans, cost + abs(a[0] - A) + abs(a[1] - B) + abs(a[2] - C));
    }
    cout << ans << endl;
    return 0;
}