#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;

#define ll long long

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

int dfs(int n, int a, int b, int c){
    int t1, t2;
    //a,b,c それぞれに対しどの竹か決めるのにそれぞれ10コスト払っている分 -30
    if(n == N){
        if(a != 0 && b != 0 && c != 0){
            return abs(A - a) + abs(B - b) + abs(C - c) - 30;
        }else{
            return 1e9; 
        }
    int ret0 = dfs(n + 1, a, b, c);
    int ret1 = dfs(n + 1, a + l[n], b, c) + 10;
    int ret2 = dfs(n + 1, a, b + l[n], c) + 10;
    int ret3 = dfs(n + 1, a, b, c + l[n]) + 10;

    t1 = min(ret0,ret1);
    t2 = min(ret2,ret3);
    return min(t1, t2);
}

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

}