#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int N, A, B, C;
vector<int> x;
int calc(int a, int b, int c) {
  return abs(accumulate(x.begin(), x.begin() + a, 0) - A) + (a - 1) * 10 +
         abs(accumulate(x.begin() + a, x.begin() + b, 0) - B) +
         (b - a - 1) * 10 +
         abs(accumulate(x.begin() + b, x.begin() + c, 0) - C) +
         (c - b - 1) * 10;
}
int main(void) {
  cin >> N >> A >> B >> C;
  x.resize(N);
  for (int i = 0; i < int(N); ++i) cin >> x[i];
  sort((x).begin(), (x).end());
  int res = INF;
  do {
    for (int c = 0; c < int(N + 1); ++c)
      for (int b = 0; b < int(c); ++b)
        for (int a = 0; a < int(b); ++a) {
          res = min(res, calc(a, b, c));
        }
  } while (next_permutation((x).begin(), (x).end()));
  cout << res << endl;
  return 0;
}
