'use strict'

/////////////////////////////////////
//コピペスペース//////////////////////

//定数
const INF  =  900719925474099 // Math.floor(Number.MAX_SAFE_INTEGER / 10);

//スペース区切りの数字列を数字の配列にして返す
function mapint(line){return line.split(' ').map((v)=>parseInt(v));}

function lower_bound(d,a,b,e){
    for(var c;1<b-a;)
        d[c=0|(a+b)/2]<e ? a=c : b=c;
    return d[a]<e?b:a
};

const MOD = 1000000007;
//コピペスペース//////////////////////
/////////////////////////////////////

function dfs(cur,a,b,c){
	if(cur == N){
		let mp = Math.abs(a-A) + Math.abs(b-B) + Math.abs(c-C) - 30;

		//console.log(a,b,c,mp);
		if(Math.min(a,b,c)<=0) return INF;
		return mp;
	}
	let ret0 = dfs(cur+1,a,b,c);
	let ret1 = dfs(cur+1,a+l[cur],b,c)+10;
	let ret2 = dfs(cur+1,a,b+l[cur],c)+10;
	let ret3 = dfs(cur+1,a,b,c+l[cur])+10;

	return Math.min(ret0,ret1,ret2,ret3);
}

let N,A,B,C;
let l;

function Main(input){
	let temp = input.trim().split('\n');
	let abc = mapint(temp[0]);
	N = abc.shift();
	A = abc.shift();
	B = abc.shift();
	C = abc.shift();

	l = new Array(N);
	for(let i=1;i<=N;i++){
		l[i-1] = parseInt(temp[i]);
	}

	console.log(dfs(0,0,0,0));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
