#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, p, N, A, B, C, a, b, c, abc[3], anum, bnum, MP,
      MP_min = 100000000, l[10], la[10], lb[10], count, gacount, gbcount,
      gccount;
  cin >> N >> A >> B >> C;
  for (i = 0; i < N; i++) {
    cin >> l[i];
  }
  for (i = 1; i < pow(2, N); i++) {
    a = 0;
    gacount = -10;
    anum = 0;
    bnum = 0;
    count = 0;
    for (p = 0; p < N; p++) {
      if ((i >> p) % 2) {
        a += l[p];
        anum++;
        gacount += 10;
      } else {
        la[count] = l[p];
        count++;
      }
    }
    count = 0;
    for (j = 1; j < pow(2, N - anum); j++) {
      gbcount = -10;
      b = 0;
      for (p = 0; p < N - anum; p++) {
        if ((j >> p) % 2) {
          b += la[p];
          bnum++;
          gbcount += 10;
        } else {
          lb[count] = la[p];
          count++;
        }
      }
      count = 0;
      for (k = 1; k < pow(2, N - anum - bnum); k++) {
        gccount = -10;
        c = 0;
        for (p = 0; p < N - anum - bnum; p++) {
          if ((k >> p) % 2) {
            c += lb[p];
            gccount += 10;
          }
        }
        abc[0] = a;
        abc[1] = b;
        abc[2] = c;
        sort(abc, abc + 3, greater<int>());
        MP = 0;
        MP += abs(abc[0] - A);
        MP += abs(abc[1] - B);
        MP += abs(abc[2] - C);
        MP += gacount;
        MP += gbcount;
        MP += gccount;
        MP_min = min(MP, MP_min);
      }
    }
  }
  cout << MP_min << endl;
}
