#include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  VI V(N);
  for (int _n = N, i = 0; i < _n; ++i) cin >> V[i];
  sort((V).begin(), (V).end());
  int ans = INT_MAX;
  do {
    for (int ss = (1), _b = ((1 << N) - 1); ss <= _b; ++ss) {
      VI W;
      for (int i = 0; i < N; i++) {
        if (ss & (1 << i)) W.push_back(V[i]);
      }
      int sz = ((int)(W).size());
      for (int i = (0), _b = (sz - 1); i <= _b; ++i) {
        for (int j = (i + 1), _b = (sz - 1); j <= _b; ++j) {
          int s1 = 0;
          for (int l = (i), _b = (j - 1); l <= _b; ++l) {
            s1 += W[l];
          }
          int cost1 = abs(C - s1) + (j - i - 1) * 10;
          for (int k = (j + 1), _b = (sz - 1); k <= _b; ++k) {
            int s2 = 0;
            for (int l = (j), _b = (k - 1); l <= _b; ++l) {
              s2 += W[l];
            }
            int cost2 = abs(B - s2) + (k - j - 1) * 10;
            int s3 = 0;
            for (int l = (k), _b = (sz - 1); l <= _b; ++l) {
              s3 += W[l];
            }
            int cost3 = abs(A - s3) + (sz - k - 1) * 10;
            int tcost = cost1 + cost2 + cost3;
            if (tcost < ans) {
              ans = tcost;
            }
          }
        }
      }
    }
  } while (next_permutation((V).begin(), (V).end()));
  cout << ans << '\n';
}
