#include <bits/stdc++.h>
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
int n, a, b, c;
vector<int> l;
int rec(int i, int suma = 0, int sumb = 0, int sumc = 0) {
  if (i == n) {
    if (suma && sumb && sumc)
      return abs(suma - a) + abs(sumb - b) + abs(sumc - c);
    else
      return 1e5;
  }
  int res = 1e5;
  for (int j = (int)0; j < (int)4; ++j) {
    int res0 = rec(i + 1, suma, sumb, sumc);
    int res1 = rec(i + 1, suma + l[i], sumb, sumc) + (suma != 0 ? 10 : 0);
    int res2 = rec(i + 1, suma, sumb + l[i], sumc) + (sumb != 0 ? 10 : 0);
    int res3 = rec(i + 1, suma, sumb, sumc) + (sumc != 0 ? 10 : 0);
    res = min({res0, res1, res2, res3});
  }
  return res;
}
void solve() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  int ans = 1e5;
  for (int i = (int)0; i < (int)n; ++i) cin >> l[i];
  for (int i = (int)0; i < (int)4; ++i) chmin(ans, rec(0));
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}
