#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int N,A,B,C,ans = 1e9;
vector<int> L;

void dfs(int n,int add,int a,int b,int c){
	if(n == N){
		ans = min(ans,abs(A - a) + abs(B - b) + abs(C - c) + add * 10);
		return;
	}

	dfs(n + 1,a,b,c);
	dfs(n + 1,add + 1, a + L[n],b,c);
	dfs(n + 1,add + 1, a,b + L[n],c);
	dfs(n + 1,add + 1, a,b,c + L[n]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	REP(i,N){
		int x;
		cin >> x;
		L.push_back(x);
	}

	
	dfs(0,0,0,0,0);

	cout << ans << endl;

}