#include <bits/stdc++.h>

using namespace std;

#define int long long
#define MOD 1000000007


#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()


#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
 
//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
 
int N;
int l[N];

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

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

    int res1 = dfs(i+1,a,b,c);
    int res2 = dfs(i+1,a+l[i],b,c)+(a>0?10:0);
    int res3 = dfs(i+1,a,b+l[i],c)+(b>0?10:0);
    int res3 = dfs(i+1,a,b,c+l[i])+(c>0?10:0);

    return min({res1,res2,res3,res4});


}

signed main(){
 
    int A,B,C;
    cin >> N >> A >> B >> C;

    int abc[3];
    abc[0]=A;
    abc[1]=B;
    abc[2]=C;

    //int l[N];
    rep(i,N){
        cin >> l[i];
    }

   cout << dfs(0,0,0,0) <<endl;


    return 0;
 
}
