#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
int n,A,B,C;
vector<int> x;
int dfs(int now,int a,int b,int c)
{
	if (now==n)
	{
		if (min(min(a,b),c)>0) return abs(A-a)+abs(B-b)+abs(C-c)-30;
		else return INF;
	}
	else
	{
		int res0=dfs(now+1,a,b,c);
		int res1=dfs(now+1,a+x[now],b,c)+10;
		int res2=dfs(now+1,a,b+x[now],c)+10;
		int res3=dfs(now+1,a,b,c+x[now])+10;
		return min(min(res0,res1),min(res2,res3));
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>A>>B>>C;
	x.resize(n,0);
	for (int i=0;i<n;++i) cin>>x[i];
	cout<<dfs(0,0,0,0);
	return 0;
}