#include <bits/stdc++.h>
using namespace std;
long long l[10];
long long N, A, B, C;
long long ans = ((long long)1e18);
long long check(long long a, long long b, long long c) {
  long long d = b - a, res = ((long long)1e18);
  for (long long i = 0; i < d; i++) {
    res = min(abs(l[i + a] - c), res);
  }
  if (res <= 10) return res;
  for (long long i = 1; i < (1 << d); i++) {
    long long temp = 0, con = 0;
    for (long long j = 0; j < d; j++) {
      if (i & (1 << j)) {
        con++;
        temp += l[j + a];
      }
    }
    res = min(res, abs(temp - c) + max(0ll, (con - 1) * 10));
  }
  return res;
}
void hoge(vector<long long>& num) {
  long long t =
      check(num[0], num[1], A) + check(num[1], num[2], B) + check(num[2], N, C);
  ans = min(ans, t);
}
void solve(long long depth, vector<long long>& num) {
  if (depth == 2) {
    hoge(num);
    return;
  }
  for (long long i = num[depth] + 1; i < N; i++) {
    num.push_back(i);
    solve(depth + 1, num);
    num.pop_back();
  }
}
void solve2() {
  vector<long long> test(1, 0);
  sort(l, l + N);
  for (;;) {
    bool flag = next_permutation(l, l + N);
    if (flag == false) return;
    solve(0, test);
  }
}
signed main() {
  cout << fixed << setprecision(10);
  cin >> N >> A >> B >> C;
  for (long long i = 0; i < (N); i++) {
    cin >> l[i];
  }
  solve2();
  cout << ans << "\n";
  return 0;
}
