#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
int synthe(int idx, vector<int> &org, vector<int> now, vector<int> &nokori) {
  if (idx == (int)(nokori).size()) {
    return abs(org[0] - now[0]) + abs(org[1] - now[1]) + abs(org[2] - now[2]);
  }
  int mp = abs(org[0] - now[0]) + abs(org[1] - now[1]) + abs(org[2] - now[2]);
  now[0] += nokori[idx];
  int ans = synthe(idx + 1, org, now, nokori);
  ans += 10;
  mp = min(mp, ans);
  now[0] -= nokori[idx];
  now[1] += nokori[idx];
  ans = synthe(idx + 1, org, now, nokori);
  ans += 10;
  mp = min(mp, ans);
  now[1] -= nokori[idx];
  now[2] += nokori[idx];
  ans = synthe(idx + 1, org, now, nokori);
  ans += 10;
  mp = min(mp, ans);
  now[2] -= nokori[idx];
  return mp;
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < (N); ++i) {
    cin >> l[i];
  }
  int ans = INF;
  for (int i = 0; i < (N); ++i) {
    for (int j = i + 1; j < N; ++j) {
      for (int k = j + 1; k < N; ++k) {
        int mp = INF;
        vector<int> nokori;
        for (int x = 0; x < (N); ++x) {
          if (x != i && x != j && x != k) {
            nokori.push_back(l[x]);
          }
        }
        vector<int> org{A, B, C};
        vector<int> now{l[i], l[j], l[k]};
        mp = min(mp, synthe(0, org, now, nokori));
        org = vector<int>{B, C, A};
        mp = min(mp, synthe(0, org, now, nokori));
        org = vector<int>{C, A, B};
        mp = min(mp, synthe(0, org, now, nokori));
        org = vector<int>{A, C, B};
        mp = min(mp, synthe(0, org, now, nokori));
        org = vector<int>{B, A, C};
        mp = min(mp, synthe(0, org, now, nokori));
        org = vector<int>{C, B, A};
        mp = min(mp, synthe(0, org, now, nokori));
        ans = min(mp, ans);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
