#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

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

int dfs(int i,int a,int b,int c){
    if(i==N){
        if(a==0||b==0||c==0) return 1e8;
        return abs(a-A)+abs(b-B)+abs(c-C);
    }
    int res=dfs(i+1,a,b,c); //L[i]の竹を選択しない
    
    res=min(res,dfs(i+1,a+L[i],b,c)+(a?10:0)); //L[i]の竹を選択
    res=min(res,dfs(i+1,a,b+L[i],c)+(b?10:0));
    res=min(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 i=0;i<N;i++){
        cin >> L[i];
    }
    cout << dfs(0,0,0,0) << endl;
}