#include <bits/stdc++.h>
int main(void) {
  int n, i, a, b, c, l0, l1, l2, l3, l4, l5, l6, l7, minmp = 32760, aa, bb, cc,
                                                     mp;
  scanf("%d %d %d %d", &n, &a, &b, &c);
  int l[8];
  for (i = 0; i < 8; i++) l[i] = 0;
  for (i = 0; i < n; i++) scanf("%d", &l[i]);
  for (l0 = 0; l0 < 4; l0++) {
    for (l1 = 0; l1 < 4; l1++) {
      for (l2 = 0; l2 < 4; l2++) {
        for (l3 = 0; l3 < 4; l3++) {
          for (l4 = 0; l4 < 4; l4++) {
            for (l5 = 0; l5 < 4; l5++) {
              for (l6 = 0; l6 < 4; l6++) {
                for (l7 = 0; l7 < 4; l7++) {
                  mp = 50;
                  aa = 0;
                  bb = 0;
                  cc = 0;
                  if (l0 == 0) mp -= 10;
                  if (l0 == 1) aa += l[0];
                  if (l0 == 2) bb += l[0];
                  if (l0 == 3) cc += l[0];
                  if (l0 == 0) mp -= 10;
                  if (l1 == 1) aa += l[1];
                  if (l1 == 2) bb += l[1];
                  if (l1 == 3) cc += l[1];
                  if (l0 == 0) mp -= 10;
                  if (l2 == 1) aa += l[2];
                  if (l2 == 2) bb += l[2];
                  if (l2 == 3) cc += l[2];
                  if (l0 == 0) mp -= 10;
                  if (l3 == 1) aa += l[3];
                  if (l3 == 2) bb += l[3];
                  if (l3 == 3) cc += l[3];
                  if (l0 == 0) mp -= 10;
                  if (l4 == 1) aa += l[4];
                  if (l4 == 2) bb += l[4];
                  if (l4 == 3) cc += l[4];
                  if (l0 == 0) mp -= 10;
                  if (l4 == 1) aa += l[5];
                  if (l5 == 2) bb += l[5];
                  if (l5 == 3) cc += l[5];
                  if (l0 == 0) mp -= 10;
                  if (l6 == 1) aa += l[6];
                  if (l6 == 2) bb += l[6];
                  if (l6 == 3) cc += l[6];
                  if (l0 == 0) mp -= 10;
                  if (l7 == 1) aa += l[7];
                  if (l7 == 2) bb += l[7];
                  if (l7 == 3) cc += l[7];
                  if (aa == 0 || bb == 0 || cc == 0) {
                    mp += abs(aa - a) + abs(bb - b) + abs(cc - c);
                    if (mp < minmp) minmp = mp;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  printf("%d", minmp);
}
