#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N,A,B,C;
vector<int> l;

int dfs(int a,int b,int c,int i){

    if(i == N){
        if(a == 0 || b == 0 || c == 0) return 1000000;
        return abs(a-A) + abs(b-B) + abs(c-C) - 30;
    }

    int val1 = dfs(a,b,c,i+1);
    int val2 = dfs(a+l[i],b,c,i+1) + 10;
    int val3 = dfs(a,b+l[i],c,i+1) + 10;
    int val4 = dfs(a,b,c+l[i],i+1) + 10;

    return min({val1,val2,val3,val4});
}

int main(){
    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;
}
