#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1001001001;
const long long LINF = 1001001001001001001;
long long n;
vector<long long> c(0);
vector<long long> mem;
vector<vector<long long>> place(200001, vector<long long>(0));
void prvec(vector<long long> vec) {
  long long n = vec.size();
  cout << "------------------------------------\n";
  for (int i = 0; i < (int)(n); i++) cout << i << " " << vec.at(i) << "\n";
  cout << "------------------------------------\n";
}
void pr2d(vector<vector<long long>> vec) {
  long long h = vec.size();
  long long w = vec.at(0).size();
  cout << "------------------------------------\n";
  for (int i = 0; i < (int)(h); i++) {
    for (int j = 0; j < (int)(w); j++) {
      cout << vec.at(i).at(j) << " ";
    }
    cout << "\n";
  }
  cout << "------------------------------------\n";
}
tuple<long long, long long, long long, long long, long long, long long>
bamboocomb(long long x, vector<long long> length_list,
           long long number_of_bamboo) {
  long long fa = 0, fb = 0, fc = 0;
  long long noca = -1, nocb = -1, nocc = -1;
  bitset<16> bx(x);
  for (long long i = 0; i < number_of_bamboo; i++) {
    if (bx.test(2 * i)) {
      if (bx.test(2 * i + 1)) {
        fc += length_list.at(i);
        nocc++;
      } else {
        fa += length_list.at(i);
        noca++;
      }
    } else {
      if (bx.test(2 * i + 1)) {
        fb += length_list.at(i);
        nocb++;
      }
    }
  }
  return {fa, fb, fc, noca, nocb, nocc};
}
int main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long long> l(n);
  for (int i = 0; i < (int)(n); i++) cin >> l.at(i);
  long long ans = INF;
  for (long long i = 0; i < (1 << (2 * n)); i++) {
    tuple<long long, long long, long long, long long, long long, long long>
        candidate = bamboocomb(i, l, n);
    if (get<0>(candidate) * get<1>(candidate) * get<2>(candidate) == 0)
      continue;
    ans = min(ans, 10 * get<3>(candidate) + abs(get<0>(candidate) - a) +
                       10 * get<4>(candidate) + abs(get<1>(candidate) - b) +
                       10 * get<5>(candidate) + abs(get<2>(candidate) - c));
  }
  cout << ans << endl;
}
