//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,a,b,c;cin>>n>>a>>b>>c;
    vector<int>l(n);
    for(int i=0;i<n;i++)
        cin>>l[i];
    ll ans=INF;
    for(int aa=1;aa<(1<<n);aa++){
        for(int bb=1;bb<(1<<n);bb++){
            if(aa&bb)continue;
            for(int cc=1;cc<(1<<n);cc++){
                if(aa&cc||bb&cc)continue;
                int unite=0;int sa=0,sb=0,sc=0;
                for(int i=0;i<3;i++){
                    if(i==0){
                        for(int j=0;j<n;j++){
                            if(aa&(1<<j)){
                                if(sa)
                                    unite+=10;
                                sa+=l[j];
                            }
                        }
                        unite+=abs(a-sa);
                    }
                    else if(i==1){
                        for(int j=0;j<n;j++){
                            if(bb&(1<<j)){
                                if(sb)
                                    unite+=10;
                                sb+=l[j];
                            }
                        }
                        unite+=abs(b-sb);
                    }
                    else if(i==2){
                        for(int j=0;j<n;j++){
                            if(cc&(1<<j)){
                                if(sc)
                                    unite+=10;
                                sc+=l[j];
                            }
                        }
                        unite+=abs(c-sc);
                    }
                    
                }//if(unite<50)cout<<unite<<endl;
                chmin(ans,unite);
            }
            
        }
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256