#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long to, cost;
};
const long long INF = 100000000000000000;
long long N, A, B, C;
long long X[10];
long long T[10];
long long Min2 = INF;
signed main() {
  cin >> N >> A >> B >> C;
  T[0] = A, T[1] = B, T[2] = C;
  sort(T, T + 3);
  for (long long i = 0; i < (N); i++) {
    cin >> X[i];
  }
  long long f = 1;
  for (long long i = 0; i < ((long long)pow(4, N)); i++) {
    long long sum = 0;
    long long b = (long long)pow(4, N);
    long long s[10] = {};
    long long d[10] = {};
    long long dc[10] = {};
    for (long long j = 0; j < (N); j++) {
      if ((i / b) % 4 == 0) {
        s[0] += X[j];
        dc[0]++;
        if (dc[0] >= 2) {
          d[0] += 10;
        }
      } else if ((i / b) % 4 == 1) {
        s[1] += X[j];
        dc[1]++;
        if (dc[1] >= 2) {
          d[1] += 10;
        }
      } else if ((i / b) % 4 == 2) {
        s[2] += X[j];
        dc[2]++;
        if (dc[2] >= 2) {
          d[2] += 10;
        }
      }
      b /= 4;
    }
    if (dc[0] == 0 || dc[1] == 0 || dc[2] == 0) {
      continue;
    }
    sort(s, s + 3);
    sum += abs(s[0] - T[0]);
    sum += abs(s[1] - T[1]);
    sum += abs(s[2] - T[2]);
    sum += d[0] + d[1] + d[2];
    if (sum == 120) {
      {} {} {} {}
    }
    Min2 = min(Min2, sum);
  }
  cout << Min2 << endl;
  return 0;
}
