#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = INT_MAX / 4;
const int MAX_LEN = 1000;
void calc_single_costs_for(const int b, vector<int> &vec) {
  for (int i = 0; i <= MAX_LEN; i++) {
    vec[i] = abs(i - b);
  }
}
int calc_min_mp(const int target, const vector<int> &bs) {
  if ((int)bs.size() == 0) {
    return INF;
  }
  vector<int> dp1(MAX_LEN + 1), dp2(MAX_LEN + 1);
  calc_single_costs_for(bs[0], dp1);
  vector<int> acc = dp1;
  for (int i = 1; i < (int)bs.size(); i++) {
    calc_single_costs_for(bs[i], dp2);
    for (int j = 0; j <= MAX_LEN; j++) {
      acc[j] = min(dp1[j], dp2[j]);
    }
    for (int j = 0; j <= MAX_LEN; j++) {
      for (int k = 0; k <= j; k++) {
        chmin(acc[j], dp1[k] + dp2[j - k] + 10);
      }
    }
    dp1 = acc;
  }
  return acc[target];
}
string show_vec(const vector<int> &bs) {
  string s;
  s += "{";
  for (auto &b : bs) {
    s += to_string(b) + ", ";
  }
  s += "}";
  return s;
}
int pow(const int base, const int x) {
  int ans = 1;
  for (int i = 0; i < x; i++) {
    ans *= base;
  }
  return ans;
}
int main(void) {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> bs(N);
  for (int i = 0; i < N; i++) {
    cin >> bs[i];
  }
  int ans = INF;
  int max_i = pow(3, N);
  for (int i = 0; i < max_i; i++) {
    int x = i;
    vector<int> bs1, bs2, bs3;
    for (int j = 0; j < N; j++) {
      int y = x % 3;
      if (y == 0) {
        bs1.push_back(bs[j]);
      } else if (y == 1) {
        bs2.push_back(bs[j]);
      } else {
        bs3.push_back(bs[j]);
      }
      x /= 3;
    }
    int cost_a = calc_min_mp(A, bs1);
    int cost_b = calc_min_mp(B, bs2);
    int cost_c = calc_min_mp(C, bs3);
    chmin(ans, cost_a + cost_b + cost_c);
  }
  cout << ans << endl;
  return 0;
}
