#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e9;
int N,A,B,C;
vector<int> l;
int dfs(int i,int a,int b,int c){
	if(i>=N){
		if(min({a,b,c})==0) return INF;
		return abs(a-A)+abs(b-B)+abs(c-C)-30;
	}
		
	int ret0,ret1,ret2,ret3;
	ret0 = dfs(i+1,a,b,c);
	ret1 = dfs(i+1,a+l[i],b,c)+10;
	ret2 = dfs(i+1,a,b+l[i],c)+10;
	ret3 = dfs(i+1,a,b,c+l[i])+10;
	
	return min({ret0,ret1,ret2,ret3});
}

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