#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(n,m,v) vector<long long> v((n),(m));
int ans=INT_MAX;
int n;
vec(8,0,k);
int a[3];
vec(8,0,v);
void init(){
    cin>>n>>a[0]>>a[1]>>a[2];
    
    rep(i,n)cin>>v[i];
}

int dfs(int i){
    if(i==n){
        int mp=0;
       /* rep(kk,n){
            cout<<k[kk]<<" ";
        }
        cout<<endl;
        rep(jj,n){
            cnt[k[jj]]++;
            tmp[k[jj]]+=v[jj];
        }*/
        if(cnt[0]*cnt[1]*cnt[2]!=0){
            rep(jj,3)mp+=abs(tmp[jj]-a[jj]);
            mp+=((cnt[0]+cnt[1]+cnt[2]-3)*10);
            return mp;
        }
        return INT_MAX;
    }
    rep(j,4){
        k[i]=j;
        //cout<<"dd"<<endl;
        ans=min(dfs(i+1),ans);
    }
    return ans;
}

int main(){
    
    init();
    cout<<dfs(0)<<endl;
    return 0;


}

