#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
const int INTINF = 2147483647;
const long long LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;
const int MAX = 10001;
struct init {
  init() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} init;
int N, A, B, C;
vector<int> L;
int minMP = 0;
int used[99];
void input() {
  std::cin >> N >> A >> B >> C;
  L.reserve(N + 1);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    int l;
    std::cin >> l;
    L.push_back(l);
    used[i] = 0;
  }
  sort((L).begin(), (L).end());
}
void solve() {
  int dC = INTINF;
  int dB = INTINF;
  int dA = INTINF;
  int argmin_dC = 0;
  int argmin_dB = 0;
  int argmin_dA = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (abs(dC) > abs(C - L[i])) {
      dC = C - L[i];
      argmin_dC = i;
    }
  }
  used[argmin_dC] = 1;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if ((abs(dB) > abs(B - L[i])) && (!used[i])) {
      dB = B - L[i];
      argmin_dB = i;
    }
  }
  used[argmin_dB] = 1;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if ((abs(dA) > abs(A - L[i])) && (!used[i])) {
      dA = A - L[i];
      argmin_dA = i;
    }
  }
  used[argmin_dA] = 1;
  if (N == 3) {
    minMP = abs(dC) + abs(dB) + abs(dA);
    return;
  }
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (used[i] == 1) continue;
    if ((dA > 10) && (abs(dA - 10) > abs(dA - L[i]))) {
      dA = dA - L[i];
      used[i] = 1;
      minMP += 10;
    } else if ((dB > 10) && (abs(dB - 10) > abs(dB - L[i]))) {
      dB = dB - L[i];
      used[i] = 1;
      minMP += 10;
    } else if ((dC > 10) && (abs(dC - 10) > abs(dC - L[i]))) {
      dC = dC - L[i];
      used[i] = 1;
      minMP += 10;
    }
  }
  minMP += abs(dC) + abs(dB) + abs(dA);
  return;
}
int main(int argc, char const *argv[]) {
  input();
  solve();
  std::cout << minMP << '\n';
  return 0;
}
