#include <bits/stdc++.h>
using u64 = uint64_t;
template <typename T>
T str2(std::string str) {
  T res;
  std::istringstream iss(str);
  iss >> res;
  return res;
}
template <class ForwardIt>
void parted_rotate(ForwardIt first1, ForwardIt last1, ForwardIt first2,
                   ForwardIt last2) {
  if (first1 == last1 || first2 == last2) return;
  ForwardIt read = first2;
  ForwardIt write = first1;
  ForwardIt nread = first1;
  while (true) {
    if (write == nread) nread = read;
    std::iter_swap(write, read);
    write++;
    read++;
    if (write == last1) {
      write = first2;
    }
    if (read == last2) {
      if (write == nread || read == last2) break;
      read = nread;
      nread = write;
    }
  }
}
template <class BidirectionalIt>
bool next_combination_impl(BidirectionalIt first1, BidirectionalIt last1,
                           BidirectionalIt first2, BidirectionalIt last2) {
  if (first1 == last1 || first2 == last2) return false;
  auto target = last1;
  --target;
  auto swap_candidate = last2;
  --swap_candidate;
  while (!(*target < *swap_candidate)) {
    if (target == first1)
      return false;
    else
      --target;
  }
  while (swap_candidate != first2 && *target < *swap_candidate) {
    if (swap_candidate == first2)
      break;
    else
      swap_candidate--;
  }
  auto it = swap_candidate;
  ++it;
  if (!(*target < *swap_candidate) && *target < *it) ++swap_candidate;
  std::iter_swap(target++, swap_candidate++);
  parted_rotate(target, last1, swap_candidate, last2);
  return true;
}
template <class BidirectionalIt>
bool next_combination(BidirectionalIt first, BidirectionalIt middle,
                      BidirectionalIt last) {
  return next_combination_impl(first, middle, middle, last);
}
template <class BidirectionalIt>
bool prev_combination(BidirectionalIt first, BidirectionalIt middle,
                      BidirectionalIt last) {
  return next_combination_impl(middle, last, first, middle);
}
std::vector<std::string> split(std::string str, std::string delimiters) {
  std::vector<std::string> result;
  while (str.length()) {
    bool found_delim = false;
    for (auto& d : delimiters) {
      auto pos = str.find_first_of(d);
      if (pos != std::string::npos) {
        result.push_back(str.substr(0, pos));
        str = str.substr(pos + 1, str.length() - pos - 1);
        found_delim = true;
      }
    }
    if (!found_delim) {
      result.push_back(str);
      return result;
    }
  }
}
u64 min1(u64 A, std::vector<u64>::iterator b, std::vector<u64>::iterator e) {
  u64 min_cost = std::numeric_limits<u64>::max();
  size_t lsize = std::distance(b, e);
  std::vector<u64> buff(lsize);
  for (u64 n = 1u; n <= lsize; ++n) {
    u64 fusion_cost = (n - 1) * 10;
    std::copy(b, e, buff.begin());
    do {
      u64 len_sum = std::accumulate(buff.begin(), buff.begin() + n, 0);
      min_cost =
          std::min(min_cost,
                   (std::max(len_sum, A) - std::min(len_sum, A)) + fusion_cost);
    } while (next_combination(buff.begin(), buff.begin() + n, buff.end()));
  }
  return min_cost;
}
u64 min2(u64 A, u64 B, std::vector<u64>::iterator b,
         std::vector<u64>::iterator e) {
  u64 min_cost = std::numeric_limits<u64>::max();
  size_t lsize = std::distance(b, e);
  std::vector<u64> buff(lsize);
  for (u64 n = 1u; n <= lsize; ++n) {
    u64 fusion_cost = (n - 1) * 10;
    std::copy(b, e, buff.begin());
    do {
      u64 len_sum = std::accumulate(buff.begin(), buff.begin() + n, 0);
      min_cost = std::min(
          min_cost, (std::max(len_sum, A) - std::min(len_sum, A)) +
                        fusion_cost + min1(B, buff.begin() + n, buff.end()));
    } while (next_combination(buff.begin(), buff.begin() + n, buff.end()));
  }
  return min_cost;
}
u64 min3(u64 A, u64 B, u64 C, std::vector<u64>::iterator b,
         std::vector<u64>::iterator e) {
  u64 min_cost = std::numeric_limits<u64>::max();
  size_t lsize = std::distance(b, e);
  std::vector<u64> buff(lsize);
  for (u64 n = 1u; n <= lsize; ++n) {
    u64 fusion_cost = (n - 1) * 10;
    std::copy(b, e, buff.begin());
    do {
      u64 len_sum = std::accumulate(buff.begin(), buff.begin() + n, 0);
      min_cost = std::min(
          min_cost, (std::max(len_sum, A) - std::min(len_sum, A)) +
                        fusion_cost + min2(B, C, buff.begin() + n, buff.end()));
    } while (next_combination(buff.begin(), buff.begin() + n, buff.end()));
  }
  return min_cost;
}
int main(int argc, char* argv[]) {
  u64 N, A, B, C;
  std::cin >> N >> A >> B >> C;
  std::vector<u64> l;
  for (u64 i = 0; i < N; ++i) {
    u64 tmp;
    std::cin >> tmp;
    l.push_back(tmp);
  }
  std::sort(l.begin(), l.end());
  std::cout << min3(A, B, C, l.begin(), l.end());
  return 0;
}
