#include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
signed 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];
  Int ans = 1e9;
  function<void(Int, Int, Int, Int, Int)> dfs = [&](Int x, Int y, Int z, Int k,
                                                    Int s) {
    if (k == n) {
      Int t = s - 30;
      t += abs(x - a);
      t += abs(y - b);
      t += abs(z - c);
      chmin(ans, t);
      return;
    }
    dfs(x, y, z, k + 1, s);
    dfs(x + l[k], y, z, k + 1, s + 10);
    dfs(x, y + l[k], z, k + 1, s + 10);
    dfs(x, y, z + l[k], k + 1, s + 10);
  };
  dfs(0, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
