#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    int n,a,b,c,l[20],x[8],ans=1e9;
    cin>>n>>a>>b>>c;
    rep(i,n) cin>>l[i];
    rep(i,pow(4,n)){
        int p=i,A=0,B=0,C=0,m=0,d[3]={0};
        rep(j,n) x[j]=p%4,p=p/4;
        rep(j,n){
            if(x[j]==1){A+=l[j],d[0]++;if(d[0]>1) m+=10;}
            if(x[j]==2){B+=l[j],d[1]++;if(d[1]>1) m+=10;}
            if(x[j]==3){C+=l[j],d[2]++;if(d[2]>1) m+=10;}
        }
        if(A==0||B==0||C==0) continue;
        m+=abs(A-a)+abs(B-b)+abs(C-c);
        if(ans>m) ans=m;
    }
    cout<<ans;
}