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

int n, A, B, C;
vector<int> v;

int MP(int cur, int a, int b, int c){
	if(cur == n){
		return min({a, b, c})==0? 1e9:abs(a-A)+abs(b-B)+abs(c-C)-30;
	}
	int pos1 = MP(cur+1, a, b, c);
	int pos2 = MP(cur+1, a+v[cur], b, c)+10;
	int pos3 = MP(cur+1, a, b+v[cur], c)+10;
	int pos4 = MP(cur+1, a, b, c+v[cur])+10;
	return min({pos1, pos2, pos3, pos4});
}

int main(){
	cin >> n >> A >> B >> C;
	for(int i = 0, k; i<n; i++){
		cin >> k;
		v.push_back(k);
	}
	cout << MP(0, 0, 0, 0) << endl;
}