#include <iostream>
#include <vector>
using namespace std;
int N,A,B,C;
vector<int> L;
int INF = 100000;

int dfs(int i, int a, int b, int c){
    if(i==N){
        if(!a || !b || !c)return INF;
        return abs(a-A)+abs(b-B)+abs(c-C);
    }
    int ret;
    ret = dfs(i+1,a,b,c);
    ret = min(ret, dfs(i+1,a+L[i],b,c)+(a?10:0));
    ret = min(ret, dfs(i+1,a,b+L[i],c)+(b?10:0));
    ret = min(ret, dfs(i+1,a,b,c+L[i])+(c?10:0));
    return ret;
}

int main(int argc, char const *argv[])
{
    cin>>N>>A>>B>>C;
    L.resize(N);
    for(int i=0;i<N;++i)cin>>L[i];
    cout << dfs(0,0,0,0) << endl;
    
    return 0;
}
