#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int a, b, c;
int solve(int num, const vector<int> &d) {
  int res = 1 << 30;
  if (num == 0) {
    int n = (int)d.size();
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        for (int k = 0; k < n; k++) {
          if (i == k or j == k) continue;
          if (i != j and j != k and k != i)
            res = min(res, abs(a - d[i]) + abs(b - d[j]) + abs(c - d[k]));
        }
      }
    }
  } else {
    int n = (int)d.size();
    for (int i = 0; i < n - 1; i++) {
      vector<int> dd;
      for (int j = 0; j < n; j++)
        if (j != i) dd.push_back(d[j]);
      for (int j = i + 1; j < n - 1; j++) {
        dd[j] += d[i];
        res = min(res, solve(num - 1, dd) + 10);
        dd[j] -= d[i];
      }
      res = min(res, solve(num - 1, dd) + 10);
    }
  }
  return res;
}
int main() {
  int n;
  cin >> n >> a >> b >> c;
  vector<int> d(n);
  for (int i = 0; i < (int)(n); ++i) cin >> d[i];
  int ans = 1 << 30;
  for (int i = 0; i <= n - 3; i++) {
    ans = min(ans, solve(i, d));
  }
  cout << ans << endl;
}
