#include <iostream>
#include <cmath>

using namespace std;

int n, k[3], l[8], min;

void calc(int b[8],int depth){
	if (depth == n) {
		int m[4] = {}, i, mp=0;
		for (i = 0;i < n;i++) {
			if (b[i] != 3 && m[b[i]] != 0) {
				mp += 10;
			}
			m[b[i]] += l[i];
		}
		for (i = 0;i < 3;i++) {
			if (m[i] == 0) {
				return;
			}
			else {
				mp += abs(m[i] - k[i]);
			}
		}
		if (mp < min) {
			min = mp;
		}
		return;
	}
	else {
		b[depth] = 0;
		calc(b, depth + 1);
		b[depth] = 1;
		calc(b, depth + 1);
		b[depth] = 2;
		calc(b, depth + 1);
		b[depth] = 3;
		calc(b, depth + 1);

		return;
	}
}

int main(void) {
	int i, j;
	cin >> n;
	cin >> k[0] >> k[1] >> k[2];

	for (i = 0;i < n;i++) {
		cin >> l[i];
	}

	min = 2000000000;
	int b[8] = {};
	calc(b, 0);

	cout << min << endl;

	return 0;
}
