#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
const int NOT_USE = 0;
const int USE_A = 1;
const int USE_B = 2;
const int USE_C = 3;
int minimum = 10000;
vector<int> best_usages;
void calc_synth(vector<int> takes, vector<int> usages) {
  int tmp_a = 0;
  int tmp_b = 0;
  int tmp_c = 0;
  bool is_a = false;
  bool is_b = false;
  bool is_c = false;
  for (size_t i = 0; i < N; i++) {
    switch (usages.at(i)) {
      case NOT_USE:
        break;
      case USE_A:
        tmp_a += takes.at(i);
        is_a = true;
        break;
      case USE_B:
        tmp_b += takes.at(i);
        is_b = true;
        break;
      case USE_C:
        tmp_c += takes.at(i);
        is_c = true;
        break;
    }
  }
  int delta = abs(A - tmp_a) + abs(B - tmp_b) + abs(C - tmp_c);
  if (delta < minimum && is_a && is_b && is_c) {
    minimum = delta;
    best_usages = usages;
  }
  return;
}
void calc_diff(vector<int> takes) {
  int tmp_a = 0;
  int tmp_b = 0;
  int tmp_c = 0;
  int count_a = 0;
  int count_b = 0;
  int count_c = 0;
  for (size_t i = 0; i < N; i++) {
    switch (best_usages.at(i)) {
      case NOT_USE:
        break;
      case USE_A:
        tmp_a += takes.at(i);
        count_a++;
        break;
      case USE_B:
        tmp_b += takes.at(i);
        count_b++;
        break;
      case USE_C:
        tmp_c += takes.at(i);
        count_c++;
        break;
    }
  }
  int synth_times = (count_a - 1) + (count_b - 1) + (count_c - 1);
  int delta = abs(A - tmp_a) + abs(B - tmp_b) + abs(C - tmp_c);
  cout << synth_times * 10 + delta << endl;
  return;
}
void dfs(int count, vector<int> takes, vector<int> usages) {
  if (count == N) {
    calc_synth(takes, usages);
    return;
  }
  for (size_t i = 0; i < 4; i++) {
    usages.at(count) = i;
    dfs(count + 1, takes, usages);
  }
  return;
}
int main(int argc, char const *argv[]) {
  cin >> N >> A >> B >> C;
  vector<int> takes(N);
  vector<int> usages(N);
  for (size_t i = 0; i < N; i++) {
    cin >> takes.at(i);
  }
  dfs(0, takes, usages);
  calc_diff(takes);
  return 0;
}
