#include <bits/stdc++.h>
using namespace std;
const long long INF = 999999999;
signed main() {
  long long n, a[3];
  cin >> n;
  for (long long i = 0; i < (3); i++) cin >> a[i];
  vector<long long> l(n);
  for (long long i = 0; i < (n); i++) cin >> l[i];
  vector<vector<long long> > mp(3, vector<long long>(300, INF));
  for (long long k = 0; k < (3); k++) {
    for (long long mask = 0; mask < (256); mask++) {
      if (mask == 0) continue;
      long long tmp = mask;
      long long res = -10, now = 0;
      for (long long i = 0; i < (n); i++) {
        if (tmp & 1) {
          now += l[i];
          res += 10;
        }
        tmp >>= 1;
      }
      mp[k][mask] = abs(now - a[k]) + res;
    }
  }
  long long ans = INF;
  for (long long i = 0; i < (256); i++)
    for (long long j = 0; j < (256); j++)
      for (long long k = 0; k < (256); k++) {
        if ((i & j) == 0 && (j & k) == 0 && (k & i) == 0) {
          ans = min(ans, (long long)mp[0][i] + mp[1][j] + mp[2][k]);
        }
      }
  cout << ans << endl;
}
