#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long int>;
using pi = pair<long long int, long long int>;
using vp = vector<pi>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  long long int n;
  cin >> n;
  long long int a, b, c;
  cin >> a >> b >> c;
  vi vl;
  for (long long int i = 0; i < n; ++i) {
    long long int l;
    cin >> l;
    vl.push_back(l);
  }
  long long int ans = INT_MAX;
  for (long long int i = 0; i < 1 << 8; ++i) {
    for (long long int j = 0; j < 1 << 8; ++j) {
      vector<long long int> sa, sb, sc;
      for (long long int k = 0; k < 8; ++k) {
        long long int bx = (i >> k) & 1;
        long long int by = (j >> k) & 1;
        if (bx == 1 && by == 0)
          sa.push_back(vl[k]);
        else if (bx == 0 && by == 1)
          sb.push_back(vl[k]);
        else if (bx == 1 && by == 1)
          sc.push_back(vl[k]);
      }
      if (sa.empty() || sb.empty() || sc.empty()) continue;
      long long int res = (sa.size() + sb.size() + sc.size() - 3) * 10;
      long long int acc = 0;
      for (long long int i = 0; i < sa.size(); ++i) {
        acc += sa[i];
      }
      res += abs(acc - a);
      acc = 0;
      for (long long int i = 0; i < sb.size(); ++i) {
        acc += sb[i];
      }
      res += abs(acc - b);
      acc = 0;
      for (long long int i = 0; i < sc.size(); ++i) {
        acc += sc[i];
      }
      res += abs(acc - c);
      chmin(ans, res);
    }
  }
  cout << ans;
  return 0;
}
