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

int N, A, B, C, *L;

// return MP
int dfs(int depth, int a, int b,int c) {
		if (depth == N) {
				if (min(min(a,b),c) > 0) return abs(A-a) + abs(B-b) + abs(C-c) - 30;
				else return 1000000000;
		}
		int du = dfs(depth+1, a, b, c);
		int ua = dfs(depth+1, a+L[depth], b, c) + 10;
		int ub = dfs(depth+1, a, b+L[depth], c) + 10;
		int uc = dfs(depth+1, a, b, c+L[depth]) + 10;
		return min(min(min(du, ua), ub), uc);
}

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