#include<iostream>
#include<cstdlib>
using namespace std;

int l[1010];
int N,A,B,C;
int INF = 99999999;

int dfs(int d,int a, int b, int c) {
    if(d == N)  {
        if(min(a,min(b,c)) == 0) return INF;
        return abs(A-a) + abs(B-b) + abs(C-c) - 30;
    }
    int res1 = dfs(d+1,a,b,c);
    int res2 = dfs(d+1,a+l[d],b,c) + 10;
    int res3 = dfs(d+1,a,b+l[d],c) + 10;
    int res4 = dfs(d+1,a,b,c+l[d]) + 10;
    return min(res1,min(res2,min(res3,res4)));
}

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