#include <bits/stdc++.h>
using namespace std;
int n,A,B,C;
vector<int> l;
const int INF = 1e5;
int rec(int i, int a, int b, int c){
  if(i == n){
    if(a==0 || b==0 || c==0){
      return INF;
    }
    return abs(A-a) + abs(B-b) + abs(C-c);
  }
  int res = rec(i+1, a, b, c);

  res = min(res, rec(i+1, a+l[i], b, c) + (a ? 10 : 0));
  res = min(res, rec(i+1, a, b+l[i], c) + (b ? 10 : 0));
  res = min(res, rec(i+1, a, b, c+l[i]) + (c ? 10 : 0));
  return res;
}

int main(){
  cin >> n >> A >> B >> C;
  l.resize(n);
  for(int i=0 ; i<n ; i++){
    cin >> l[i];
  }
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}
