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