#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int N, A, B, C;
vector<int> l;
int dfs(int n, int a, int b, int c) {
	if (n == N) {
		if (a == 0 || b == 0 || c == 0) {
			return 2e5;
		}
		int tmp = abs(a-A) + abs(b-B) + abs(c-C) - 30;
		return tmp; 
	}

	int ans1 = dfs(n+1, a, b, c);
	int ans2 = dfs(n+1, a+l[n], b, c) + 10;
	int ans3 = dfs(n+1, a, b+l[n], c) + 10;
	int ans4 = dfs(n+1, a, b, c+l[n]) + 10;

	return min({ans1, ans2, ans3, ans4});
}


int main() {
	cin >> N >> A >> B >> C;
	l.resize(N);
	rep(i, N) cin >> l[i];

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