#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (const auto &v : vec) {
    os << v << ",";
  }
  os << "]";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
void solve() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  int mi = 1 << 29;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        if (i == j || j == k || i == k) continue;
        vector<int> I;
        for (int l = 0; l < N; l++) {
          if (l == i || l == j || l == k) continue;
          I.push_back(l);
        }
        int M = I.size();
        for (int si = 0; si < 1 << M; si++) {
          for (int sj = 0; sj < 1 << M; sj++) {
            for (int sk = 0; sk < 1 << M; sk++) {
              if (si & sj != 0) continue;
              if (sj & sk != 0) continue;
              if (si & sk != 0) continue;
              int sum1 = L[i];
              int sum2 = L[j];
              int sum3 = L[k];
              int cost = 0;
              for (int l = 0; l < M; l++) {
                if (si >> l & 1) {
                  sum1 += L[I[l]];
                  cost += 10;
                }
                if (sj >> l & 1) {
                  sum2 += L[I[l]];
                  cost += 10;
                }
                if (sk >> l & 1) {
                  sum3 += L[I[l]];
                  cost += 10;
                }
              }
              cost += abs(sum1 - A) + abs(sum2 - B) + abs(sum3 - C);
              mi = min(mi, cost);
            }
          }
        }
      }
    }
  }
  cout << mi << "\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
}
