#if 1

#include <bits/stdc++.h>
using namespace std;
int n,a,b,c,l[10],ans;
void dfs(int x,int A,int B,int C,int s)
{
    if(x > n)
    {
        if(A && B && C) ans = min(ans,s+abs(a-A)+abs(b-B)+abs(c-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 ()
{
    ans = 1000000000;
    scanf("%d %d %d %d", &n, &a, &b, &c);
    for(int i = 1;i <= n;i++) scanf("%d",&l[i]);
    dfs (1,0,0,0,0);
    printf("%d",ans);
    return 0;
}

#endif // 1++