#include <bits/stdc++.h>
const int INF = 1000000000;
int n;
int target[3];
std::vector<int> l;
int solve(int i = 0, int a = 0, int b = 0, int c = 0) {
  if (i == n) {
    if (!a || !b || !c)
      return INF;
    else
      return std::abs(a - target[0]) + std::abs(b - target[1]) +
             std::abs(c - target[2]);
  }
  int cost = INF;
  cost = std::min(cost, solve(i + 1, a, b, c));
  cost = std::min(cost, solve(i + 1, a + l[i], b, c) + (a ? 10 : 0));
  cost = std::min(cost, solve(i + 1, a, b + l[i], c) + (b ? 10 : 0));
  cost = std::min(cost, solve(i + 1, a, b, c + l[i]) + (c ? 10 : 0));
  return cost;
}
int main() {
  std::cin >> n;
  l.assign(3, 0);
  for (int i = 0; i < 3; i++) std::cin >> target[i];
  for (int i = 0; i < n; i++) {
    std::cin >> l[i];
  }
  std::cout << solve() << std::endl;
  return 0;
}
