#include <bits/stdc++.h>
using namespace std;
inline int ceileing(int a, int b) { return a % b == 0 ? a / b : a / b + 1; }
template <typename T, typename Pred = less<T>>
void sort_vec(vector<T>& v, Pred p = Pred()) {
  sort(v.begin(), v.end(), p);
}
template <typename T, typename Op = plus<T>>
T accumrate(T init, const vector<T>& v, Op op = Op()) {
  for (auto p : v) init = op(init, p);
  return init;
}
int distance(vector<int>& a, vector<int>& b) {
  auto sum = 0;
  for (size_t i = 0; i < a.size(); i++) sum += abs(a[i] - b[i]);
  return sum;
}
int main() {
  int N;
  cin >> N;
  auto target = vector<int>(3);
  for (size_t i = 0; i < 3; i++) cin >> target[i];
  auto bamboo = vector<int>(N);
  for (size_t i = 0; i < N; i++) cin >> bamboo[i];
  auto answer = accumrate(0, bamboo);
  auto result = vector<int>(3, 0);
  int use, ans, mod;
  for (int state = 0; state < pow(4, N) - 1; state++) {
    ans = 0;
    use = state;
    for (size_t i = 0; i < N; i++) {
      mod = use & 0b11;
      if (mod != 3) {
        if (result[mod] != 0) ans += 10;
        result[mod] += bamboo[i];
      }
      use >>= 2;
    }
    bool accepct = true;
    for (size_t i = 0; i < 3; i++) {
      if (result[i] == 0) accepct = false;
    }
    if (accepct) answer = min(answer, ans + distance(target, result));
    for (int i = 0; i < 3; i++) result[i] = 0;
  }
  cout << answer << endl;
}
