#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;
const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N, A, B, C;
vector<int> L;
ll calc(vector<int> groups, int cost) {
  if (groups.size() < 3) {
    return INF;
  }
  int result = INF;
  sort(groups.begin(), groups.end());
  for (int i = 1; i < groups.size(); i++) {
    int med = abs(groups[i] - B);
    int left = INF;
    int right = INF;
    for (int l = 0; l < i; l++) {
      left = min(left, abs(groups[l] - C));
    }
    for (int r = i + 1; r < N; r++) {
      right = min(right, abs(groups[r] - A));
    }
    result = min(result, cost + med + left + right);
  }
  return result;
}
ll ans = LL_INF;
void dfs(int pos, vector<int> &groups, int cost) {
  if (pos >= N) {
    ans = min(ans, calc(groups, cost));
    return;
  }
  groups.push_back(L[pos]);
  dfs(pos + 1, groups, cost);
  groups.pop_back();
  for (int i = 0; i < groups.size(); i++) {
    groups[i] += L[pos];
    dfs(pos + 1, groups, cost + 10);
    groups[i] -= L[pos];
  }
  return;
}
int main() {
  cin >> N >> A >> B >> C;
  L.resize(N);
  for (auto &val : L) {
    cin >> val;
  }
  sort(L.begin(), L.end());
  vector<int> groups;
  dfs(0, groups, 0);
  cout << ans << endl;
  return 0;
}
