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

#define INF (1<<30)

int dfs(int a, int b, int c, int i);

int N,A,B,C;
int l[9];

int main(){
	cin>>N>>A>>B>>C;
	for(int i=0;i<N;i++)cin>>l[i];

	int ans=dfs(0,0,0,0);

	cout<<ans<<endl;

	return 0;
}


int dfs(int a, int b, int c, int i){
	if(i==N){
		if(a && b && c ){
			return abs(a-A) + abs(b-B) + abs(c-C) - 30;
		}else return INF;
	}

	int ans=dfs(a,b,c, i+1);
	ans = min(ans, dfs(a+l[i], b	 , c	 , i+1) + 10);
	ans = min(ans, dfs(a	 , b+l[i], c	 , i+1) + 10);
	ans = min(ans, dfs(a	 , b	 , c+l[i], i+1) + 10);

	return ans;
}
