#include <bits/stdc++.h>
using ull = long long;
using namespace std;
template <typename T>
inline void dump(const T& x) {
  cout << "[" << x << "]" << endl;
}
template <typename T>
inline void dump(const vector<T>& x) {
  for (const auto v : x) {
    cout << v << " ";
  }
  cout << endl;
}
template <typename T>
inline void sort_asc(vector<T>& x) {
  std::sort(x.begin(), x.end());
}
template <typename T>
inline void sort_desc(vector<T>& x) {
  std::sort(x.begin(), x.end(), greater<T>());
}
ull dfs(ull bottom, const vector<ull>& l, ull A, ull B, ull C, ull depth, ull a,
        ull b, ull c) {
  if (depth == bottom) {
    return abs(A - a) + abs(B - b) + abs(C - c) - 30;
  }
  vector<ull> res;
  res.emplace_back(dfs(bottom, l, A, B, C, depth + 1, a, b, c));
  res.emplace_back(dfs(bottom, l, A, B, C, depth + 1, a + l[depth], b, c) + 10);
  res.emplace_back(dfs(bottom, l, A, B, C, depth + 1, a, b + l[depth], c) + 10);
  res.emplace_back(dfs(bottom, l, A, B, C, depth + 1, a, b, c + l[depth]) + 10);
  return *min_element(res.begin(), res.end());
}
int main() {
  ull n, a, b, c;
  vector<ull> l;
  cin >> n >> a >> b >> c;
  for (auto i = 0; i < n; i++) {
    ull tmp;
    cin >> tmp;
    l.emplace_back(tmp);
  }
  auto r = dfs(n, l, a, b, c, 0, 0, 0, 0);
  cout << r << endl;
  return 0;
}
