#include <bits/stdc++.h>
using namespace std;
string p_bit(int x, int p) {
  int keta = 1;
  for (int nn = 1; pow(p, nn) <= x; nn++) {
    keta = nn + 1;
  }
  int seisububun[keta];
  int amari = x;
  for (int ii = 0; ii < keta; ii++) {
    seisububun[keta - 1 - ii] = amari / pow(p, (keta - 1 - ii));
    int y = pow(p, (keta - 1 - ii));
    amari = amari % y;
  }
  string sss;
  for (int jj = 0; jj < keta; jj++) {
    string SS = to_string(seisububun[keta - 1 - jj]);
    sss = sss + SS;
  }
  stringstream W;
  W << setfill('0') << left << setw(8) << sss;
  return (sss);
}
int count1(string r) {
  int count = 0;
  for (int i = 0; i < r.size(); i++)
    if (r[i] == '1') count++;
  return count;
}
int count2(string r) {
  int count = 0;
  for (int i = 0; i < r.size(); i++)
    if (r[i] == '2') count++;
  return count;
}
int count3(string r) {
  int count = 0;
  for (int i = 0; i < r.size(); i++)
    if (r[i] == '3') count++;
  return count;
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int l[N];
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  int useMP = 0;
  int sum = 10000000;
  for (int i = 16; i < pow(4, N); i++) {
    string s = p_bit(i, 4);
    int la = 0;
    int lb = 0;
    int lc = 0;
    for (int j = 0; j < N; j++) {
      if (s[j] == 'i') {
        la = la + l[j];
      } else if (s[j] == '2') {
        lb = lb + l[j];
      } else if (s[j] == '3') {
        lc = lc + l[j];
      }
      int result = 0;
      result = abs(A - la) + abs(B - lb) + abs(C - lc) +
               (count1(p_bit(i, 4)) - 1 + count2(p_bit(i, 4)) - 1 +
                count3(p_bit(i, 4)) - 1) *
                   10;
      if (sum > result) {
        sum = result;
      }
    }
  }
  cout << sum << endl;
}
