#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector <ll> bamboo;
ll ans = LLONG_MAX;
ll n,A,B,C;

void func(ll index,ll a,ll b,ll c,ll cost) {
	if (index == bamboo.size()){
		if (a == 0 || b == 0 || c == 0) return;
		ans = min(ans,abs(A-a)+abs(B-b)+abs(C-c)+cost-30);
		return;
	}
	func(index+1,a+bamboo[index],b,c,cost+10);
	func(index+1,a,b+bamboo[index],c,cost+10);
	func(index+1,a,b,c+bamboo[index],cost+10);
	func(index+1,a,b,c,cost);
}

int main() {
	cin >> n >> A >> B >> C;
	bamboo.resize(n);
	for (int z=0;z<n;z++){
		cin >> bamboo[z];
	}
	func(0,0,0,0,0);
	cout << ans << endl;
	cin >> n;
}