// Slower C++ solution:
#include <bits/stdc++.h>

  using namespace std;

#define ll long long

#define fw(p) for(int w=0;w<(p);w++)

#define fx(p) for(int x=0;x<(p);x++)

#define fy(p) for(int y=0;y<(p);y++)

#define fz(p) for(int z=0;z<(p);z++)

#define fyg(p,g) for(int y=(g);y<(p);y++)

#define fzg(p,g) for(int z=(g);z<(p);z++)

#define ce(d) cout<<d<<endl;

#define vecp(p) int aa;cin>>aa;(p).push_back(aa);

#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);

#define vecps(p) string aa;cin>>aa;(p).push_back(aa);

#define vecp2(p) cin>>aa;(p).push_back(aa);

#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);

#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);

#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }

#define sorts(c) sort((c).begin(),(c).end());

#define reverses(c) reverse((c).begin(),(c).end());

#define vec(b) vector<int> (b);

#define vecl(b) vector<long long> (b);

#define vecs(b) vector<string> (b);

#define vecsize(b,size) vector<int> (b)((size));

#define pb(b,a) (b).push_back((a));

#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;

#define pairs(s) vector<pair<int,int>> (s);

#define pairsl(s) vector<pair<ll,ll>> (s);

#define pairss(s) vector<pair<string,string>> (s);

#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));

#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));

#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));

#define pairsREV(s) (s).push_back(make_pair(bb,aa));

#define pairslREV(s) (s).push_back(make_pair(bb,aa));

#define pairssREV(s) (s).push_back(make_pair(bb,aa));

#define MOD 1000000007

	int bamboo[10];

int main() {

	

	int N,A,B,C;

	

	cin>>N>>A>>B>>C;

	int ans=INT_MAX;



	fx(N){

		cin>>bamboo[x];

	}

	for(int x=0;x<4<<(N*2);x++){

		int a=0,b=0,c=0,mp=-3;

		fy(N){

		int z=(x>>y*2)%4;

			switch(z){

				case 1:a+=bamboo[y];mp++;break;

				case 2:b+=bamboo[y];mp++;break;

				case 3:c+=bamboo[y];mp++;break;

				default:break;

			}

		}

		if(mp<0){continue;}

      if(a==0||b==0||c==0){continue;}

		ans=min(ans,abs(A-a)+abs(B-b)+abs(C-c)+mp*10);

	}

	ce(ans)



}

// Faster C++ solution for the same problem (measured speedup: 1.2356091949386925x):
#include <bits/stdc++.h>

using namespace std;



#define ll long long

#define fw(p) for(int w=0;w<(p);w++)

#define fx(p) for(int x=0;x<(p);x++)

#define fy(p) for(int y=0;y<(p);y++)

#define fz(p) for(int z=0;z<(p);z++)

#define fyg(p,g) for(int y=(g);y<(p);y++)

#define fzg(p,g) for(int z=(g);z<(p);z++)

#define ce(d) cout<<d<<endl;

#define vecp(p) int aa;cin>>aa;(p).push_back(aa);

#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);

#define vecps(p) string aa;cin>>aa;(p).push_back(aa);

#define vecp2(p) cin>>aa;(p).push_back(aa);

#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);

#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);

#define sorts(c) sort((c).begin(),(c).end());

#define reverses(c) reverse((c).begin(),(c).end());

#define vec(b) vector<int> (b);

#define vecl(b) vector<long long> (b);

#define vecs(b) vector<string> (b);

#define pb(b,a) (b).push_back((a));

#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;

#define pairs(s) vector<pair<int,int>> (s);

#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));

#define MOD 1000000007

#define cey ce("Yes")

#define cen ce("No")

#define ceY ce("YES")

#define ceN ce("NO")

int N, A, B, C;

vec(L);

int ans = INT_MAX;

void search(int i, int a, int b, int c, int sum) {



	if (i==N) {

		if (a == 0 || b == 0 || c == 0) { return; }

		ans = min(ans, sum + abs(a - A)+ abs(b - B)+ abs(c - C));

		return;

	}



	search(i + 1, a + L[i], b, c, sum + (a == 0 ? 0 : 10));

	search(i + 1, a, b + L[i], c, sum + (b == 0 ? 0 : 10));

	search(i + 1, a , b, c + L[i], sum + (c == 0 ? 0 : 10));

	search(i + 1, a , b, c, sum );



}



int main()

{



	cin >> N >> A >> B >> C;





	fx(N) {

		vecp(L);

	}



	search(0, 0, 0, 0, 0);

	

	ce(ans)

    return 0;

}