#include <bits/stdc++.h>
using namespace std;
struct Bamboo {
  int mp;
  int da;
  int db;
  int dc;
};
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < n; ++i) cin >> l[i];
  vector<Bamboo> bamboo;
  for (int i = 0; i < (1 << n); ++i) {
    int length = 0;
    int mp = -10;
    for (int j = 0; j < n; ++j) {
      if ((i >> j) & 1) {
        length += l[j];
        mp += 10;
      }
    }
    mp = max(mp, 0);
    int da = abs(a - length);
    int db = abs(b - length);
    int dc = abs(c - length);
    bamboo.emplace_back(Bamboo{mp, da, db, dc});
  }
  const int m = 1 << n;
  int ret = 1000000000;
  for (int ia = 0; ia < m; ++ia) {
    for (int ib = 0; ib < m; ++ib) {
      if (ia & ib) continue;
      for (int ic = 0; ic < m; ++ic) {
        if ((ia & ic) || (ib & ic)) continue;
        int cost = bamboo[ia].da + bamboo[ia].mp + bamboo[ib].db +
                   bamboo[ib].mp + bamboo[ic].dc + bamboo[ic].mp;
        ret = min(ret, cost);
      }
    }
  }
  cout << ret << "\n";
  return 0;
}
