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

int n,a,b,c;
int arr[10];

int dfs(int idx,int A,int B,int C){
	if(idx==n){
		if(min(A,min(B,C))>0) return abs(a-A)+abs(b-B)+abs(c-C)-30;
		else return (1<<30);
	}
	
	int ret = dfs(idx+1,A+arr[idx],B,C) + 10;
	int ret1 = dfs(idx+1,A,B+arr[idx],C) + 10;
	int ret2 = dfs(idx+1,A,B,C+arr[idx]) + 10;
	int ret3 = dfs(idx+1,A,B,C);
	
	return min(ret,min(ret1,min(ret2,ret3)));
}

int main(){
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for(int i=0;i<n;i++){
		scanf("%d",&arr[i]);
	}
	int ans=dfs(0,0,0,0);
	printf("%d",ans);
}