#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, A[3];
  cin >> N >> A[0] >> A[1] >> A[2];
  vector<long long> l(N);
  for (long long& x : l) cin >> x;
  const long long inf = 1LL << 62;
  long long ans = inf;
  vector<bool> used(N);
  for (long long a = 0; a < (1 << N); a++) {
    for (long long b = 0; b < (1 << N); b++) {
      for (long long c = 0; c < (1 << N); c++) {
        long long sum[3] = {}, cnt[3] = {};
        for (long long i = 0; i < N; i++) {
          if ((a >> i) & 1) {
            sum[0] += l[i];
            cnt[0]++;
          } else if ((b >> i) & 1) {
            sum[1] += l[i];
            cnt[1]++;
          } else if ((c >> i) & 1) {
            sum[2] += l[i];
            cnt[2]++;
          }
        }
        long long t = 0;
        for (long long i = 0; i < 3; i++) {
          t += abs(A[i] - sum[i]);
          t += max(0LL, (long long)(cnt[i] - 1) * 10);
        }
        ans = min(ans, t);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
