#include <bits/stdc++.h>
using namespace std;
int dfs(int, int, int, int);
int N, A, B, C;
int L[8] = {};
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  cout << "----\n";
  cout << dfs(0, 0, 0, 0) << endl;
}
int dfs(int depth, int a, int b, int c) {
  if (depth - N) {
    int score_a = dfs(depth + 1, a + L[depth], b, c) + (a ? 10 : 0);
    int score_b = dfs(depth + 1, a, b + L[depth], c) + (b ? 10 : 0);
    int score_c = dfs(depth + 1, a, b, c + L[depth]) + (c ? 10 : 0);
    int score_z = dfs(depth + 1, a, b, c);
    return min({score_a, score_b, score_c, score_z});
  } else {
    if (a * b * c) {
      return abs(a - A) + abs(b - B) + abs(c - C);
    } else {
      return 1e9;
    }
  }
}
