#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
void recursive_comb(int* indexes, int s, int rest,
                    std::function<void(int*)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<long long> l(N);
  for (long long i = 0; i < N; ++i) {
    cin >> l[i];
  }
  long long total_mp = 0;
  long long AA = A;
  long long BB = B;
  long long CC = C;
  long long min_mpA = INF;
  long long min_patA = 0;
  long long min_mpB = INF;
  long long min_patB = 0;
  long long min_mpC = INF;
  long long min_patC = 0;
  for (long long k = 1; k < 1LL << N; ++k) {
    long long cost = -10;
    long long len = 0;
    long long used = 0;
    for (long long bit = 0; bit < N; ++bit) {
      if ((k >> bit) & (1LL)) {
        cost += 10;
        len += l[bit];
        used++;
      }
    }
    long long mpA = abs(AA - len) + cost;
    long long mpB = abs(BB - len) + cost;
    long long mpC = abs(CC - len) + cost;
    if (mpA < min_mpA && N - used >= 2) {
      min_mpA = mpA;
      min_patA = k;
    }
    if (mpB < min_mpB && N - used >= 2) {
      min_mpB = mpB;
      min_patB = k;
    }
    if (mpC < min_mpC && N - used >= 2) {
      min_mpC = mpC;
      min_patC = k;
    }
  }
  long long min_mpD, min_patD;
  if (min_mpA <= min_mpB && min_mpA <= min_mpC) {
    min_mpD = min_mpA;
    min_patD = min_patA;
    AA = BB;
    BB = CC;
  }
  if (min_mpB <= min_mpA && min_mpB <= min_mpC) {
    min_mpD = min_mpB;
    min_patD = min_patB;
    AA = AA;
    BB = CC;
  }
  if (min_mpC <= min_mpA && min_mpC <= min_mpB) {
    min_mpD = min_mpC;
    min_patD = min_patC;
    AA = AA;
    BB = BB;
  }
  total_mp += min_mpD;
  vector<long long> tmp_l;
  for (long long bit = 0; bit < N; ++bit) {
    if ((min_patD >> bit) & (1LL)) {
    } else {
      tmp_l.push_back(l[bit]);
    }
  }
  l = tmp_l;
  N = l.size();
  min_mpA = INF;
  min_patA = 0;
  min_mpB = INF;
  min_patB = 0;
  for (long long k = 1; k < 1LL << N; ++k) {
    long long cost = -10;
    long long len = 0;
    long long used = 0;
    for (long long bit = 0; bit < N; ++bit) {
      if ((k >> bit) & (1LL)) {
        cost += 10;
        len += l[bit];
        used++;
      }
    }
    long long mpA = abs(AA - len) + cost;
    long long mpB = abs(BB - len) + cost;
    if (mpA < min_mpA && N - used >= 1) {
      min_mpA = mpA;
      min_patA = k;
    }
    if (mpB < min_mpB && N - used >= 1) {
      min_mpB = mpB;
      min_patB = k;
    }
  }
  if (min_mpA <= min_mpB) {
    min_mpD = min_mpA;
    min_patD = min_patA;
    AA = BB;
  } else {
    min_mpD = min_mpB;
    min_patD = min_patB;
    AA = AA;
  }
  total_mp += min_mpD;
  tmp_l.clear();
  for (long long bit = 0; bit < N; ++bit) {
    if ((min_patD >> bit) & (1LL)) {
    } else {
      tmp_l.push_back(l[bit]);
    }
  }
  l = tmp_l;
  N = l.size();
  min_mpA = INF;
  min_patA = 0;
  for (long long k = 1; k < 1LL << N; ++k) {
    long long cost = -10;
    long long len = 0;
    long long used = 0;
    for (long long bit = 0; bit < N; ++bit) {
      if ((k >> bit) & (1LL)) {
        cost += 10;
        len += l[bit];
        used++;
      }
    }
    long long mp = abs(AA - len) + cost;
    if (mp < min_mpA) {
      min_mpA = mp;
      min_patA = k;
    }
  }
  total_mp += min_mpA;
  cout << total_mp << "\n";
}
