#include <bits/stdc++.h>
int n, a[3], l[8], r[3], flag[8], dist, mindist, mincost, minr[3], minflag[8];
int cost() {
  int check[3] = {0, 0, 0};
  for (int i = 0; i < 8; i++) {
    if (flag[i] >= 3) continue;
    if (l[i] == 0) continue;
    check[flag[i]] = 1;
  }
  for (int i = 0; i < 3; i++) {
    if (check[i] == 0) return -1;
  }
  for (int i = 0; i < 3; i++) {
    r[i] = 0;
  }
  int c = 0;
  for (int i = 0; i < 8; i++) {
    if (flag[i] >= 3) continue;
    if (l[i] == 0) continue;
    if (r[flag[i]] != 0) {
      c += 10;
    }
    r[flag[i]] += l[i];
  }
  dist = 0;
  for (int i = 0; i < 3; i++) {
    dist += abs(r[i] - a[i]);
  }
  return c;
}
void comb_search(int depth) {
  if (depth == n) {
    int c = cost();
    if (c < 0) return;
    if (mindist >= dist) {
      if (mincost >= c) {
        mindist = dist;
        mincost = c;
        for (int i = 0; i < 3; i++) {
          minr[i] = r[i];
        }
        for (int i = 0; i < 8; i++) {
          minflag[i] = flag[i];
        }
      }
    }
    return;
  }
  for (int i = 0; i < 4; i++) {
    flag[depth] = i;
    comb_search(1 + depth);
  }
  return;
}
int main() {
  std::cin >> n >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < 8; i++) {
    l[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    std::cin >> l[i];
  }
  int temp = 0;
  mindist = 100000, mincost = 100000;
  comb_search(temp);
  std::cout << mincost + mindist << "\n";
  return 0;
}
