#include <bits/stdc++.h>
using namespace std;
template <size_t T>
bool prevSubset(bitset<T>& bs, const bitset<T>& mask) {
  bs = bs.to_ulong() - 1ull;
  bs &= mask;
  if (bs.none()) return false;
  return true;
}
const int INF = INT_MAX / 2;
int main() {
  int n;
  cin >> n;
  vector<int> v(3);
  for (int i = 0; i < 3; ++i) cin >> v[i];
  vector<int> l(n);
  for (int i = 0; i < n; ++i) cin >> l[i];
  vector<int> dp(1 << n, INF);
  dp.back() = 0;
  for (int i = 0; i < 3; ++i) {
    vector<int> nextDp(1 << n, INF);
    for (int a = 0; a < (1 << n); ++a) {
      bitset<32> mask(a);
      bitset<32> bs = mask;
      do {
        int sum = 0;
        for (int j = 0; j < n; ++j) {
          if (bs[j]) sum += l[j];
        }
        int b = (mask ^ bs).to_ulong();
        nextDp[b] = min(nextDp[b],
                        dp[a] + abs(sum - v[i]) + ((int)bs.count() - 1) * 10);
      } while (prevSubset(bs, mask));
    }
    dp = move(nextDp);
  }
  int ans = *min_element(dp.begin(), dp.end());
  cout << ans << endl;
  return 0;
}
