#include <iostream>
#include <vector>

using namespace std;

int N, A, B, C;
vector<int> l;

int min = 99999;

void calc(vector<int> v) {
    int a = 0, b = 0, c = 0, dupe = 0;
    for (int i = 0; i < N; i++) {
        if (v[i] == 0) {
            if (a != 0) dupe += 10;
            a += l[i];
        }
        if (v[i] == 1) {
            if (b != 0) dupe += 10;
            b += l[i];
        }
        if (v[i] == 2) {
            if (c != 0) dupe += 10;
            c += l[i];
        }
    }
    const int sum = abs(a - A) + abs(b - B) + abs(c - C) + dupe;
    if (a == 0 || b == 0 || c == 0) return;
    if (sum < min) {
        min = sum;
        for (int i = 0; i < N; i++) {
            cout << v[i] << " ";
        }
        cout << sum << endl;
    }
    
    return;
}

void dfs(int cur, vector<int> v) {
    if (cur == N) {
        calc(v);
        return;
    }
    for (int i = 0; i < 4; i++) {
        v[cur] = i;
        dfs(cur + 1, v);
    }
    return;
}

int main() {
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }
    dfs(0, vector<int>(N));

	cout << min << endl;

    return 0;
}