#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 30;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  array<int, 3> a;
  cin >> n >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  int l[9];
  for (int i = 0; i < n; ++i) {
    cin >> l[i];
  }
  long long wa[266] = {0};
  long long cost[266] = {0};
  for (int i = 0; i < (1 << n); ++i) {
    cost[i] = -10;
    for (int j = 0; j < n; ++j) {
      if ((1 & i >> j) == 1) {
        wa[i] += l[j];
        cost[i] += 10;
      }
    }
  }
  long long cosA[3];
  long long miID[3];
  long long ans = INF;
  cost[0] = INF;
  do {
    for (int i = 0; i < 3; ++i) {
      long long mi = INF;
      for (int j = 0; j < (1 << n); ++j) {
        long long co = cost[j] + abs(a[i] - wa[j]);
        if (mi > co) {
          mi = co;
          miID[i] = j;
        }
      }
      cosA[i] = mi;
      cost[miID[i]] = INF;
    }
    ans = min(ans, cosA[0] + cosA[1] + cosA[2]);
    cout << cosA[0] + cosA[1] + cosA[2] << endl;
  } while (next_permutation(a.begin(), a.end()));
  cout << ans << endl;
}
