#include <bits/stdc++.h>

using namespace std;
int A,B,C,n,len[10000];
int dfs(int x,int a,int b,int c)
{
    if(x == n){
        if(min(a,min(b,c)) > 0) return abs(a-A)+abs(b-B)+abs(c-C)-30;
        else return 100000000;
    }
    int num1 = dfs(x+1,a,b,c) ;
    int num2 = dfs(x+1,a+len[x],b,c) + 10;
    int num3 = dfs(x+1,a,b+len[x],c) + 10;
    int num4 = dfs(x+1,a,b,c+len[x]) + 10;
    return min(min(num1,min(num2,num3)),num4);
}
int main()
{
    cin>>n>>A>>B>>C;
    for(int i = 0;i < n; ++i) cin>>len[i];
    cout<<dfs(0,0,0,0)<<endl;
    return 0;
}