#include <bits/stdc++.h>
using namespace std;
const int tam = 10000010;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, su[3];
  cin >> n;
  for (int i = 0; i < 3; i++) cin >> su[i];
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  int ord[] = {0, 1, 2};
  int res = 1000000007;
  do {
    int cos1 = 1000000007, ind1;
    for (int i = 1; i < 1 << n; i++) {
      if (__builtin_popcount(i) < n - 2) {
        int parcos = (__builtin_popcount(i) - 1) * 10, parsu = 0;
        for (int j = 0; j < n; j++) {
          parsu += (((1 << j) & i) ? 1 : 0) * ar[j];
        }
        parcos += abs(parsu - su[ord[0]]);
        vector<int> segu;
        for (int j = 0; j < n; j++) {
          if (!((1 << j) & i)) segu.push_back(ar[j]);
        }
        int ta = segu.size();
        for (int j = 1; j < 1 << ta; j++) {
          if (__builtin_popcount(j) < ta - 1) {
            int parcos2 = (__builtin_popcount(j) - 1) * 10, parsu2 = 0;
            for (int k = 0; k < ta; k++) {
              parsu2 += (((1 << k) & j) ? 1 : 0) * segu[k];
            }
            parcos2 += abs(parsu2 - su[ord[1]]);
            vector<int> ter;
            for (int k = 0; k < ta; k++) {
              if (!((1 << k) & j)) ter.push_back(segu[k]);
            }
            int ta2 = ter.size();
            for (int k = 1; k < 1 << ta2; k++) {
              int parcos3 = (__builtin_popcount(k) - 1) * 10, parsu3 = 0;
              for (int l = 0; l < ta2; l++) {
                parsu3 += (((1 << l) & k) ? 1 : 0) * ter[l];
              }
              parcos3 += abs(parsu3 - su[ord[2]]);
              res = min(res, parcos + parcos2 + parcos3);
            }
          }
        }
      }
    }
  } while (next_permutation(ord, ord + 3));
  cout << res << '\n';
  return 0;
}
