#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const int INF = 1e9;
const int MOD = INF + 7;
const i64 LINF = 1e18;
signed main() {
  int64_t N, A, B, C;
  cin >> N;
  vector<int64_t> take(3);
  for (int64_t(i) = 0; (i) < (3); ++(i)) cin >> take[i];
  vector<int64_t> L(N);
  for (int64_t(i) = 0; (i) < (N); ++(i)) cin >> L[i];
  sort(L.begin(), L.end());
  L.push_back(-INF);
  int64_t ans = INF;
  do {
    int64_t cost = 0;
    int64_t now = L[0];
    int64_t j = 1;
    for (int64_t(i) = 0; (i) < (3); ++(i)) {
      while (j < N - 2 - i &&
             abs(take[i] - (now + L[j])) < abs(take[i] - now)) {
        now += L[j];
        j++;
        cost += 10;
      }
      cost += abs(take[i] - now);
      now = L[j];
      j++;
    }
    ans = min(ans, cost);
  } while (next_permutation(L.begin(), L.end()));
  cout << ans << endl;
}
