#include <bits/stdc++.h>
using namespace std;

int N,A,B,C;
vector<int>l;
int inf=1e9;
int dfs(int i,int a,int b,int c){
	if(i==N){ 
		if(a==0||b==0||c==0)return inf;
		else return abs(a-A)+abs(b-B)+abs(c-C);
	}
	int ret1,ret2,ret3,ret4;
	ret1=dfs(i+1,a,b,c);
	ret2=dfs(i+1,a+l[i],b,c)+((a==0)?0:10);
	ret3=dfs(i+1,a,b+l[i],c)+((b==0)?0:10);
	ret4=dfs(i+1,a,b,c+l[i])+((c==0)?0:10);
	return min({ret1,ret2,ret3,ret4});

}

int main(){
cin>>N>>A>>B>>C;
l.assign(N,0);
for(auto&& w:l)cin>>w;
cout<<dfs(0,0,0,0)<<endl;

}