#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int N, A, B, C;
vector<int> l;

int dfa(int cur, int a, int b, int c){
  if(cur==N){
    if(min({a,b,c})>0){
      return abs(A-a)+abs(B-b)+abs(C-c)-30;
    } else {
      return 10e8;
    }
  }

  return min({dfa(cur+1,a,b,c),
	dfa(cur+1,a+l[cur],b,c)+10,
	dfa(cur+1,a,b+l[cur],c)+10,
	dfa(cur+1,a,b,c+l[cur])+10});
}

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

  cout << dfa(0,0,0,0) << endl;
  
  return 0;
}
