#include <bits/stdc++.h>
using namespace std;

int N,A,B,C,l[10];

int rec(int cur, int a, int b, int c){
    if(cur == N){
        if(!a || !b || !c)return pow(10,9);
        return abs(a-A)+abs(b-B)+abs(c-C);
    }

    int res=rec(cur+1,a,b,c);

    res=min(res,rec(cur+1,a+l[cur],b,c) + (a ? 10:0));
    res=min(res,rec(cur+1,a,b+l[cur],c) + (b ? 10:0));
    res=min(res,rec(cur+1,a,b,c+l[cur]) + (c ? 10:0));

    return res;
}

int main(){
    cin >> N >> A >> B >> C;
    for(int i=0;i<N;i++){
        cin >> l[i];
    }
    cout << rec(0,0,0,0);
}