#include <bits/stdc++.h>
using namespace std;
vector<int> list;
vector<int> goal;
int min_s;
int N, A, B, C;
int try_take(vector<int> try_list, int ni) {
  int ans;
  if (ni > N) return -1;
  int sum[4] = {0};
  int cnt[4] = {0};
  for (int ti = 0; ti < try_list.size(); ti++) {
    sum[try_list[ti]] += list[ti];
    cnt[try_list[ti]]++;
  }
  if (sum[1] > 0 && sum[2] > 0 && sum[3] > 0) {
    ans = abs(sum[1] - goal[1]) + abs(sum[2] - goal[2]) + abs(sum[3] - goal[3]);
    ans += (cnt[1] + cnt[2] + cnt[3] - 3) * 10;
    if (ans > min_s) return -1;
    if (ans < min_s) min_s = ans;
  }
  for (int ti = 0; ti < 4; ti++) {
    vector<int> new_try_list = try_list;
    new_try_list.push_back(ti);
    try_take(new_try_list, ni + 1);
  }
  return 0;
}
int main() {
  int l;
  cin >> N >> A >> B >> C;
  goal.push_back(0);
  goal.push_back(A);
  goal.push_back(B);
  goal.push_back(C);
  for (int ni = 0; ni < N; ni++) {
    cin >> l;
    list.push_back(l);
  }
  sort(list.begin(), list.end());
  min_s = 1e9;
  vector<int> try_zero;
  try_take(try_zero, 0);
  printf("%d", min_s);
  return 0;
}
