#include<bits/stdc++.h>
using namespace std;
int l[17];
int n,aa,bb,cc;
int ans=1e9;
void dfs(int x,int a,int b,int c,int s){
    if(x>n){
        if(a&&b&&c)
            ans=min(ans,s+abs(aa-a)+abs(bb-b)+abs(cc-c));
        return;
    }
    dfs(x+1,a,b,c,s);
    dfs(x+1,a+l[x],b,c,s+10*(a>0));
    dfs(x+1,a,b+l[x],c,s+10*(b>0));
    dfs(x+1,a,b,c+l[x],s+10*(c>0));
}
int main(){
    scanf("%d%d%d%d",&n,&aa,&bb,&cc);
    for(int i=1;i<=n;i++)
        scanf("%d",&l[i]);
    dfs(1,0,0,0,0);
    printf("%d",ans);
    return 0;
}
