#include "bits/stdc++.h"
using namespace std;

int N, A, B, C, L[8] = {}, INF = 1000000000;

int DFS(int sum, int a, int b, int c) {
	if (sum == N) {
		if (a > 0 && b > 0 && c > 0) return abs(A - a) + abs(B - b) + abs(C - c) - 30;
		else return INF;
	}
	int ret1 = DFS(sum + 1, a, b, c);
	int ret2 = DFS(sum + 1, a + L[sum], b, c) + 10;
	int ret3 = DFS(sum + 1, a, b + L[sum], c) + 10;
	int ret4 = DFS(sum + 1, a, b, c + L[sum]) + 10;
	return min(min(ret1, ret2), min(ret3, ret4));
}

int main() {
	cin >> N >> A >> B >> C;
	for (int i = 0; i < N; i++) {
		cin >> L[i];
	}
	cout << DFS(0, 0, 0, 0);
}