#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const int MOD = (int)1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-2, -1};
int dx[4] = {-1, -2};
const int MAX = 1000050;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int n, a, b, c;
vector<int> v;
vector<vector<int> > cand;
int makeT(vector<int>& v, int t) {
  int idx = 0;
  int ret = abs(v[0] - t);
  for (int i = (1); i < ((int)(v).size()); ++i) {
    if (abs(v[i] - t) < ret) {
      idx = i;
      ret = abs(v[i] - t);
    }
  }
  v.erase(v.begin() + idx);
  return ret;
}
int makeABC(const vector<int>& v) {
  int ret = INF;
  vector<int> ts(3);
  ts[0] = a, ts[1] = b, ts[2] = c;
  do {
    vector<int> nv = v;
    int locret = 0;
    locret += makeT(nv, ts[0]);
    locret += makeT(nv, ts[1]);
    locret += makeT(nv, ts[2]);
    ret = min(locret, ret);
  } while (next_permutation((ts).begin(), (ts).end()));
  return ret;
}
void makeCand(vector<int> v, int k) {
  if (k == 0) {
    cand.push_back(v);
  }
  for (int i = (0); i < ((int)(v).size()); ++i)
    for (int j = (i + 1); j < ((int)(v).size()); ++j) {
      vector<int> nv = v;
      nv[i] += nv[j];
      nv.erase(nv.begin() + j);
      makeCand(nv, k - 1);
    }
}
void solve() {
  int ret = INF;
  for (int i = (0); i < (n - 2); ++i) {
    cand.clear();
    makeCand(v, i);
    for (int j = (0); j < ((int)(cand).size()); ++j) {
      ret = min(ret, makeABC(cand[j]) + 10 * i);
    }
  }
  cout << ret << endl;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> a >> b >> c;
  v.resize(n);
  for (int i = (0); i < (n); ++i) {
    cin >> v[i];
  }
  solve();
  return 0;
}
