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

int n;
int C, B, A;

int l[1005];

int dfs(int k, int a, int b, int c){
	if(k == n){
		if(a == 0 || b == 0 || c == 0) return 1e9;
		return abs(A-a) + abs(B-b) + abs(C-c);
	}
	int ans = 1e9;
	ans = min(ans,dfs(k+1,a+l[k],b,c)+(a>0 ? 10:0));
	ans = min(ans,dfs(k+1,a,b+l[k],c)+(b>0 ? 10:0));
	ans = min(ans,dfs(k+1,a,b,c+l[k])+(c>0 ? 10:0));
	ans = min(ans,dfs(k+1,a,b,c));
	return ans;
}

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