#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,d[256],i,j,k,l,r;
int main(){
	cin>>n>>a>>b>>c;
	for(i=0;i<n;i++){
		cin>>l;
		for(j=0;j<=k;j++)d[j+k+1]=d[j]+l;
		k+=k+1;
	}
	r=d[0]=5e8;
	for(i=0;i<=k;i++)for(j=0;j<=k;j++)r=min(r,abs(d[i&j]-a)+abs(d[i&~j]-b)+abs(d[j&~i]-c)+__builtin_popcount(i|j)*10);
	cout<<r-30<<endl;
}
