#include <bits/stdc++.h>
using namespace std;
long long N;
long long A, B, C;
long long l[10];
long long dist(long long a) {
  if (a >= 0)
    return a;
  else
    return -a;
}
long long costcalc(long long a, long long b, long long c) {
  return dist(A - a) + dist(B - b) + dist(C - c);
}
signed main() {
  cin >> N;
  cin >> A >> B >> C;
  for (long long(i) = 0; (i) < (N); (i)++) {
    cin >> l[i];
  }
  long long minv = LLONG_MAX;
  long long fin = 1 << (2 * N);
  for (long long(cunt) = 0; (cunt) < (fin); (cunt)++) {
    long long i = cunt;
    long long res[3];
    res[0] = 0;
    res[1] = 0;
    res[2] = 0;
    long long cost = 0;
    for (long long(n) = 0; (n) < (N); (n)++) {
      long long y = i % 4;
      if (y != 3) {
        if (res[y] != 0) {
          cost += 10;
        }
        res[y] += l[n];
      }
      i /= 4;
    }
    sort(res, res + 3);
    if (res[2] == 0) {
      continue;
    }
    cost += costcalc(res[2], res[1], res[0]);
    minv = min(cost, minv);
    cout << cost << endl;
  }
  cout << minv << endl;
  return 0;
}
