#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const ll INFLL = (1LL << 62) - 1;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
template <typename T>
inline ll suma(const vector<T>& a) {
  ll res(0);
  for (auto&& x : a) res += x;
  return res;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int n, a, b, c;
vi l;
int ans = INF;
void rec(int i, int la, int lb, int lc, int mp) {
  if (i == n) {
    mp += abs(a - la) + abs(b - lb) + abs(c - lc);
    ans = min(ans, mp);
    return;
  }
  rec(i + 1, la + l[i], lb, lc, mp + 10 - (la == 0 ? 10 : 0));
  rec(i + 1, la, lb + l[i], lc, mp + 10 - (lb == 0 ? 10 : 0));
  rec(i + 1, la, lb, lc + l[i], mp + 10 - (lc == 0 ? 10 : 0));
  rec(i + 1, la, lb, lc, mp);
  return;
}
int main() {
  cin >> n >> a >> b >> c;
  l = vi(n);
  for (int i = (0); i < (n); ++i) cin >> l[i];
  rec(0, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
