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