#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  constexpr int N_MAX = 8;
  int N, A, B, C;
  std::cin >> N >> A >> B >> C;
  static int L[N_MAX];
  for (int i = 0; i < N; ++i) {
    std::cin >> L[i];
  }
  int i, j;
  int sup = std::numeric_limits<int>::max();
  int iSup = 1 << (N << 1);
  int mp = sup, tmp;
  int NA, NB, NC;
  int LA, LB, LC;
  int state;
  for (i = 0; i < iSup; ++i) {
    NA = 0;
    NB = 0;
    NC = 0;
    LA = 0;
    LB = 0;
    LC = 0;
    tmp = 0;
    for (j = 0; j < N; ++j) {
      state = (i >> (j << 1)) & 3;
      switch (state) {
        case 0:
          break;
        case 1:
          ++NA;
          LA += L[j];
          break;
        case 2:
          ++NB;
          LB += L[j];
          break;
        case 3:
          ++NC;
          LC += L[j];
          break;
        default:
          break;
      }
    }
    if (NA == 0 || NB == 0 || NC == 0) {
      tmp = sup;
    } else {
      tmp += std::abs(LA - A) + (NA - 1) * 10;
      tmp += std::abs(LB - B) + (NB - 1) * 10;
      tmp += std::abs(LC - C) + (NC - 1) * 10;
    }
    mp = std::min(mp, tmp);
  }
  std::cout << mp << std::endl;
  return 0;
}
