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