#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<limits.h>

using namespace std;

int main()
{
	int ans = INT_MAX;
	int n, a, b, c;
	vector<int> kadomatu;
	vector<int> takechoice;
	int wk;

	int wa, wb, wc;
	int mpa, mpb, mpc;


	cin >> n >> a >> b >> c;

	for (int i = 0; i < n; i++) {
		cin >> wk;
		kadomatu.push_back(wk);
		takechoice.push_back(0);
	}

	int loop = pow(4, n);
	int wkans;
	for (int i = 0; i < loop; i++) {
		wkans = 0;
		wk = i;
		for (int j = 0; j < n; j++) {
			takechoice[j] = wk % 4;
			wk /= 4;
		}

		wa = 0;
		wb = 0;
		wc = 0;

		for (int j = 0; j < n; j++) {
			if (takechoice[j] == 0) {
				wa += kadomatu[j];
				if (wa != kadomatu[j])wkans += 10;

			}
			else if (takechoice[j] == 1) {
				wb += kadomatu[j];
				if (wb != kadomatu[j])wkans += 10;

			}
			else if(takechoice[j] == 2){
				wc += kadomatu[j];
				if (wc != kadomatu[j])wkans += 10;

			}
		}

		if (wa * wb * wc == 0)continue;

		wkans += abs(a - wa);
		wkans += abs(b - wb);
		wkans += abs(c - wc);

		if (wkans < ans)ans = wkans;






	}



	cout << ans << endl;




	return 0;



}

