#include<bits/stdc++.h>
using namespace std;
int A,B,C,n;
int l[9];
int dfs(int id,int a,int b,int c)
{
	int r1,r2,r3,r4;
	if(id==n)
	{
		if(a==0||b==0||c==0)
			return 8001;
		return abs(a-A)+abs(b-B)+abs(c-C);
	}
	r1=dfs(id+1,a+l[id+1],b,c)+10;
	r2=dfs(id+1,a,b+l[id+1],c)+10;
	r3=dfs(id+1,a,b,c+l[id+1])+10;
	r4=dfs(id+1,a,b,c);
	return min(r1,min(r2,min(r3,r4)));
}
int main()
{
	int i;
	scanf("%d %d %d %d",&n,&A,&B,&C);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&l[i]);
	}
	printf("%d",dfs(0,0,0,0)-30);
	return 0;
}