#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    int l[n];
    rep(i, 0, n) cin >> l[i];

    int ans = 1000000000;
    for (int i = 0; i < (1 << n); i++) {
        int sum_a = 0;
        int mp_a = 0;
        bool used_a[n] = {};
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                if (sum_a != 0) mp_a += 10;
                sum_a += l[j];
                used_a[j] = true;
            }
        }

        for (int k = 0; k < (1 << n); k++) {
            int sum_b = 0;
            int mp_b = 0;
            bool used_b[n] = {};
            for (int m = 0; m < n; m++) {
                if (k & (1 << m) && !used_a[m]) {
                    if (sum_b != 0) mp_b += 10;
                    sum_b += l[m];
                    used_b[m] = true;
                }
            }

            for (int p = 0; p < (1 << n); p++) {
                int sum_c = 0;
                int mp_c = 0;
                for (int q = 0; q < n; q++) {
                    if (p & (1 << q) && !used_a[q] && !used_b[q]) {
                        if (sum_c != 0) mp_c += 10;
                        sum_c += l[q];
                    }
                }

                int mpsum = 0;
                mpsum += (mp_a + mp_b + mp_c);
                mpsum += (abs(sum_a - a) + abs(sum_b - b) + abs(sum_c -c));
                ans = min(ans, mpsum);
            }

        }


    }

    cout << ans << endl;
    return 0;
}
