#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

int solve(int a, int b, int c, int n) {
	if (n == N) {
		if (!(a && b && c)) return 1e9;
		return abs(A - a) + abs(B - b) + abs(C - c);
	}
	int r0 = solve(a, b, c, n + 1);
	int r1 = solve(a + l[n], b, c, n + 1) + (a ? 10 : 0);
	int r2 = solve(a, b + l[n], c, n + 1) + (b ? 10 : 0);
	int r3 = solve(a, b, c + l[n], n + 1) + (c ? 10 : 0);
	return min({ r0, r1, r2, r3 });
}

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

	return 0;
}