#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,b,c;
ll L[10];
ll dfs(ll i,ll j,ll k,ll l){
	if(i==n){
		if(j!=0&&k!=0&&l!=0){
			return abs(a-j)+abs(b-k)+abs(c-l);
		}else{
			return 1000000000000;
		}
	}
	ll A=dfs(i+1,j+L[i],k,l)+10;
	ll B=dfs(i+1,j,k+L[i],l)+10;
	ll C=dfs(i+1,j,k,l+L[i])+10;
	ll D=dfs(i+1,j,k,l);
	ll E=min(A,B);
	ll F=min(C,D);
	return min(E,F);
}
int main(void){
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++){
		cin>>L[i];
	}
	ll ans=dfs(0,0,0,0)-30;
	cout<<ans<<endl;
	
}
