#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
} 

const int INF = 1LL << 20;

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

int rec(int i, int a, int b, int c) {
    if (i == N) {
        if (!a || !b || !c) return INF;
        return abs(a - A) + abs(b - B) + abs(c - C);
    } 

    int rec = rec(i+1, a, b, c);

    chmin(rec, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(rec, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(rec, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));

    return rec;
}

int main(){
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++) cin >> L[i];

    cout << rec(0, 0, 0, 0) << endl;
}