#include <iostream>
#include <cmath>
using namespace std;
int l[10];
int main(){
	int i,j,n,a,b,c,ans = 1000000;
	cin >> n >> a >> b >> c;
	for(i=0;i<n;i++){
		cin >> l[i];
	}
	for(i=0;i<1<<(2*n);i++){
		int res[10],k;
		k = i;
		for(j=0;j<n;j++){
			res[j] = k%4;
			k /= 4;
		}
		int sum[4] = {},num[4] = {},ret = 0;
		for(j=0;j<n;j++){
			sum[res[j]] += l[j];
			num[res[j]]++;
		}
		for(j=0;j<3;j++){
			if(num[j]==0) ret = 10000000;
			else ret += 10*(num[j] - 1);
		}
		ret += abs(a - sum[0]) + abs(b - sum[1]) + abs(c - sum[2]);
		ans = min(ans,ret);
	}
	cout << ans << endl;
}