#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

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

int dfs(int ind,int a,int b,int c){
  if (ind == N){
    if (min({a,b,c})>0) return abs(a-A)+abs(b-B)+abs(c-C)-30;
    else return 100000000;
  }
  int cond0 = dfs(ind+1,a,b,c);
  int cond1 = dfs(ind+1,a+l[ind],b,c)+10;
  int cond2 = dfs(ind+1,a,b+l[ind],c)+10;
  int cond3 = dfs(ind+1,a,b,c+l[ind])+10;

  return min({cond0,cond1,cond2,cond3});
}

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;
}
