#include <bits/stdc++.h>
struct E {
  int mp;
  int bamboos;
};
struct S {
  std::vector<E>::iterator a, b, c;
};
struct C {
  bool operator()(const S &x, const S &y) const {
    return x.a->mp + x.b->mp + x.c->mp > y.a->mp + y.b->mp + y.c->mp;
  }
};
int calc_mp(int target, int bamboos, std::vector<int> &lengths) {
  if (bamboos == 0) {
    return INT_MAX / 3;
  }
  int mp = -10;
  int n = lengths.size();
  for (int i = 0; i < n; i++) {
    if (bamboos & (1 << i)) {
      mp += 10;
      target -= lengths[i];
    }
  }
  mp += std::abs(target);
  return mp;
}
int main() {
  int n, a, b, c;
  std::cin >> n >> a >> b >> c;
  std::vector<int> l(n);
  for (auto &li : l) std::cin >> li;
  int m = 1 << n;
  std::vector<E> ae(m), be(m), ce(m);
  for (int i = 0; i < m; i++) {
    ae[i].bamboos = i;
    be[i].bamboos = i;
    ce[i].bamboos = i;
    ae[i].mp = calc_mp(a, i, l);
    be[i].mp = calc_mp(b, i, l);
    ce[i].mp = calc_mp(c, i, l);
  }
  std::sort(ae.begin(), ae.end(),
            [](const E &x, const E &y) { return x.mp < y.mp; });
  std::sort(be.begin(), be.end(),
            [](const E &x, const E &y) { return x.mp < y.mp; });
  std::sort(ce.begin(), ce.end(),
            [](const E &x, const E &y) { return x.mp < y.mp; });
  std::priority_queue<S, std::vector<S>, C> q;
  q.push({ae.begin(), be.begin(), ce.begin()});
  for (;;) {
    S s = q.top();
    q.pop();
    if ((s.a->bamboos & s.b->bamboos) == 0 &&
        (s.a->bamboos & s.c->bamboos) == 0 &&
        (s.b->bamboos & s.c->bamboos) == 0) {
      std::cout << (s.a->mp + s.b->mp + s.c->mp);
      break;
    }
    q.push({s.a + 1, s.b, s.c});
    q.push({s.a, s.b + 1, s.c});
    q.push({s.a, s.b, s.c + 1});
  }
}
