#include<iostream>
#include<algorithm>
using namespace std;
int n,a,b,c,take[8];

int rec(int i,int j,int k,int l){
  if(i>=n){
	if(!(j&&k&&l))return 1.0e+9;
	return abs(a-j)+abs(b-k)+abs(c-l);
  }
  
  int ar[4]={rec(i+1,j+take[i],k,l),rec(i+1,j,k+take[i],l),rec(i+1,j,k,l+take[i]),rec(i+1,j,k,l)};
  if(j)ar[0]+=10;
  if(k)ar[1]+=10;
  if(l)ar[2]+=10;
  sort(ar,ar+4);
  
  return ar[0];
}

int main(){
  cin>>n>>a>>b>>c;
  for(int i=0;i<n;++i)
	cin>>take[i];
  
  cout<<rec(0,0,0,0)<<endl;
  return 0;
}
