#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
lint N, A, B, C, INF = 1e9;
vector<lint> l(N);

lint dfs(lint num, lint a, lint b, lint c){
	if(num == N){
		if(min({a, b, c}) > 0) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else return INF;
	} 
	lint w = dfs(num + 1, a, b, c);
	lint x = dfs(num + 1, a + l[num], b, c) + 10;
	lint y = dfs(num + 1, a, b + l[num], c) + 10;
	lint z = dfs(num + 1, a, b, c + l[num]) + 10;
	return min({x, y, z, w});
}

signed main(){
  cin >> N >> A >> B >> C;
	l.resize(N);
	for(lint i = 0; i < N; i++) cin >> l[i];
	cout << dfs(0, 0, 0, 0) << endl;
}