#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int N, A, B, C;
vector<int> l;

int dfs(int, int, int, int);
int main(){
	cin >> N >> A >> B >> C;

	l.resize(N);
	for(int i = 0; i < N; ++i){
		cin >> l[i];
	}

	cout << dfs(0, 0, 0, 0) << endl;

	return 0;
}
	
int dfs(int n, int a, int b, int c){
	if(n == N){
		if(min({a, b, c}) > 0){
			return abs(a-A)+abs(b-B)+abs(c-C) - 30;
		}else{
			return 10000000; // INF
		}
	}
	int p1 = dfs(n+1, a+l[n], b, c) + 10;
	int p2 = dfs(n+1, a, b+l[n], c) + 10;
	int p3 = dfs(n+1, a, b, c+l[n]) + 10;
	int p4 = dfs(n+1, a, b, c);

	return min({p1, p2, p3, p4});
}

