#include <bits/stdc++.h>
using namespace std;
int n, a[3], l[8], ans = 10000;
void func2(vector<int>& v) {
  int maxi = 0;
  for (int i = 0; i < v.size(); i++) {
    maxi = max(v[i], maxi);
  }
  if (maxi < 2) return;
  vector<int> v2(maxi + 1, 0);
  for (int i = 0; i < v.size(); i++) {
    v2[v[i]] += l[i];
  }
  int anst = (n - (maxi + 1)) * 10;
  vector<int> v3;
  for (int i = 0; i < 3; i++) v3.push_back(a[i]);
  int minai = 0, minaj = 0;
  for (int i = 0; i < v3.size(); i++) {
    for (int j = 0; j < v2.size(); j++) {
      if (abs(v3[i] - v2[j]) < abs(v3[minai] - v2[minaj])) {
        minai = i;
        minaj = j;
      }
    }
    if (i + 1 == v3.size()) {
      anst += abs(v3[minai] - v2[minaj]);
      v3.erase(v3.begin() + minai);
      v2.erase(v2.begin() + minaj);
      i = -1;
      minai = 0, minaj = 0;
    }
  }
  ans = min(anst, ans);
  return;
}
void func(vector<int>& v, int id) {
  if (id == n) {
    func2(v);
    return;
  }
  int maxv = 0;
  for (int i = 0; i < v.size(); i++) {
    maxv = max(v[i], maxv);
  }
  for (int i = 0; i <= maxv + 1; i++) {
    v.push_back(i);
    func(v, id + 1);
    v.pop_back();
  }
  return;
}
void solve() {
  cin >> n >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < n; i++) cin >> l[i];
  vector<int> v;
  v.push_back(0);
  func(v, 1);
  cout << ans << endl;
  return;
}
int main() {
  solve();
  return 0;
}
