//グローバル変数定義
var N = 0;
var A = 0;
var B = 0;
var C = 0;
var T = [];	//N本の竹の長さを配列BBに格納する

function rec(cur, a, b, c){
  
  if(cur == N){
    var mp = Math.abs(a-A) + Math.abs(b-B) + Math.abs(c-C) - 30;
	if(Math.min(a,b,c)<=0){
      return Infinity;
    }
	return mp;
  }
  
  var ret0 = rec(cur+1,a,b,c);
  var ret1 = rec(cur+1,a+T[cur],b,c)+10;
  var ret2 = rec(cur+1,a,b+T[cur],c)+10;
  var ret3 = rec(cur+1,a,b,c+T[cur])+10;

  var tmp = Math.min(ret0,ret1,ret2,ret3);
  return tmp;
}
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  N = Number.parseInt(inputStr[0]);
  A = Number.parseInt(inputStr[1]);
  B = Number.parseInt(inputStr[2]);
  C = Number.parseInt(inputStr[3]);

  //N本の竹の長さを配列BBに格納する
  for( var i=0 ; i<N ; i++ ){
    T.push(Number.parseInt(input[i+1].split(" ")));
  }
  var tmp = rec(0, 0, 0, 0);
  console.log(tmp);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));