#include<bits/stdc++.h>
using namespace std;
int n,a,b,c;
int l[1001];
int dfs(int k,int aa,int bb,int cc){
    if(k==n){
        if (aa == 0 || bb == 0 || cc == 0) return 1e9;
        return abs(aa-a)+abs(bb-b)+abs(cc-c);
    }
    int res = 1e9;
    res = min(res,dfs(k+1,aa+l[k],bb,cc)+(aa>0 ? 10:0));
    res = min(res,dfs(k+1,aa,bb+l[k],cc)+(bb>0 ? 10:0));
    res = min(res,dfs(k+1,aa,bb,cc+l[k])+(cc>0 ? 10:0));
    res = min(res,dfs(k+1,aa,bb,cc));
    return res;
}
int main(){
    cin>>n>>a>>b>>c;
    for(int i = 0; i<n;i++){
        cin>>l[i];
    }
    int res = dfs(0,0,0,0);
    cout<<res<<endl;
    return 0;
}