// Synthetic Kadomatsu
#include <bits/stc++.h>
using namespace std;
#define ll long long

ll a,b,c,n;
int *arr;
ll Synthetic(ll x,ll y,ll z,ll i){
	if(i == n){
		if(x<0||y<0||z<0) return 1e11;
		else return abs(a-x)+abs(b-y)+abs(c-z)-30;
	}

	ll op1 = Synthetic(x,y,z,i+1);
	ll op2 = Synthetic(x+arr[i],y,z,i+1)+10;
	ll op3 = Synthetic(x,y+arr[i],z,i+1)+10;
	ll op4 = Synthetic(x,y,z+arr[i],i+1)+10;
	return min(op1,min(op2,min(op3,op4)));
}

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