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

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

int dfs(int n,int a,int b,int c){
	if(n == N){
		if(!min({a,b,c})) return 1e9;
		return abs(A - a) + abs(B - b) + abs(C - c) - 30;
	}

	int x =	dfs(n + 1,a,b,c);
	int y = dfs(n + 1, a + L[n], b, c) + 10;
	int z = dfs(n + 1, a, b + L[n], c) + 10;
	int q = dfs(n + 1, a, b, c + L[n]) + 10;
	return min({x,y,z,q});
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> A >> B >> C;

	REP(i,N){
		int x;
		cin >> x;
		L.push_back(x);
	}

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

}