#include <iostream>
#include <algorithm>
using namespace std;

int n, a, b, c, ans = 1000000000;
int l[10];

void dfs(int m, int x, int y, int z, int mp) {
	if (m == n) {
		if (x == 0 || y == 0 || z == 0) return;
		ans = min(ans, abs(x - a) + abs(y - b) + abs(z - c) + mp - 30);
		return;
	}
	dfs(m + 1, x + l[m], y, z, mp + 10);
	dfs(m + 1, x, y + l[m], z, mp + 10);
	dfs(m + 1, x, y, z + l[m], mp + 10);
	dfs(m + 1, x, y, z, mp);
}

int main() {
	cin >> n >> a >> b >> c;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	dfs(0, 0, 0, 0, 0);
	cout << ans << endl;
}