#include <bits/stdc++.h>

using namespace std;


int N,A,B,C;
vector<int> l(8);


int dps(int i, int a, int b, int c){
    
    if (i == N) {
        if (a*b*c != 0) {
            return abs(A-a)+abs(B-b)+abs(C-c)-30;
            
        }else{

            return 88000;
        }
        
    }else{
        return min(min(dps(i+1, a, b, c), dps(i+1, a+l[i], b, c)+10), min(dps(i+1, a, b+l[i], c)+10, dps(i+1, a, b, c+l[i])+10));
    }
    
    
    
    
}



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

