#include <bits/stdc++.h>
int n, a[3];
int l[8], used[8];
int dfs(int, int);
int main() {
  scanf("%d%d%d%d", &n, a, a + 1, a + 2);
  for (int i{}; i < n; i++) scanf("%d", l + i);
  std::fill(used, used + n, -1);
  printf("%d\n", dfs(0, 0));
  return 0;
}
int dfs(int index, int a_i) {
  if (index == n) {
    a_i++;
    index = 0;
  }
  if (a_i == 3) {
    int each_sum[3]{}, ret{-30};
    for (int i{}; i < n; i++)
      if (used[i] >= 0) {
        each_sum[used[i]] += l[i];
        ret += 10;
      }
    for (int i{}; i < 3; i++) {
      if (!each_sum[i]) return 1 << 30;
      ret += std::abs(each_sum[i] - a[i]);
    }
    return ret;
  }
  if (used[index] >= 0) return dfs(index + 1, a_i);
  int min{dfs(index + 1, a_i)};
  for (int i{}; i < 3; i++) {
    used[index] = i;
    min = std::min(min, dfs(index + 1, a_i));
  }
  used[index] = -1;
  return min;
}
