#include <bits/stdc++.h>
using namespace std;
template <class T>
T ceil(T a, T b) {
  return (a + b - 1) / b;
}
template <class T>
T round(T a, T b) {
  return (a + b / 2) / b;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
bool amax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool amin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = (int)(0); i < (int)(N); i += (int)(1)) {
    cin >> l[i];
  }
  int res = 1000000;
  for (int i = (int)(0); i < (int)(1 << N); i += (int)(1)) {
    for (int ii = (int)(0); ii < (int)(1 << N); ii += (int)(1)) {
      vector<int> _l;
      int cost = 0, sum[2] = {}, cnt[2] = {};
      for (int j = (int)(0); j < (int)(N); j += (int)(1)) {
        if ((i >> j) & 1 && (ii >> j) & 1) {
          continue;
        }
        if ((i >> j) & 1) {
          sum[0] += l[j];
          cnt[0]++;
        } else if ((ii >> j) & 1) {
          sum[1] += l[j];
          cnt[1]++;
        } else {
          _l.push_back(l[j]);
        }
      }
      if (cnt[0] == 1 || cnt[1] == 1) {
        continue;
      }
      if (cnt[0] > 1) {
        _l.push_back(sum[0]);
        cost += 10 * (cnt[0] - 1);
      }
      if (cnt[1] > 1) {
        _l.push_back(sum[1]);
        cost += 10 * (cnt[1] - 1);
      }
      int s = _l.size();
      for (int p = (int)(0); p < (int)(s); p += (int)(1)) {
        for (int q = (int)(0); q < (int)(s); q += (int)(1)) {
          for (int r = (int)(0); r < (int)(s); r += (int)(1)) {
            if (p == q || q == r || r == p) {
              continue;
            }
            amin(res, cost + abs(A - _l[p]) + abs(B - _l[q]) + abs(C - _l[r]));
          }
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}
