#include <bits/stdc++.h>
using namespace std;
int N,A,B,C;
vector<int> L;

void chmin(int &x,int y){
    if(x > y){
        x = y;
    }
}

int DFS(int i,int a,int b,int c){

    if(i == N){ //終了条件
        if(!a || !b || !c){
            return 100000;
        }
        else {
            return abs(a - A) + abs(b - B) + abs(c - C);
        }
    }
    int res = rec(i+1,a,b,c);
    chmin(res,DFS(i+1,a + L[i],b,c) + (a ? 10 : 0));
    chmin(res,DFS(i+1,a,b + L[i],c) + (b ? 10 : 0));
    chmin(res,DFS(i+1,a,b,c + L[i]) + (c ? 10 : 0));

    return res;

}


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

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