#include <bits/stdc++.h>
int main() {
  int i, N, A, B, C, l[10];
  scanf("%d %d %d %d", &N, &A, &B, &C);
  for (i = 1; i <= N; i++) scanf("%d", &(l[i]));
  int min = 1 << 30, flag[10] = {0, 1, 2, 3}, sum[4], tmp;
  while (flag[N + 1] == 0) {
    for (i = 1, tmp = -30, sum[0] = 0, sum[1] = 0, sum[2] = 0, sum[3] = 0;
         i <= N; i++) {
      sum[flag[i]] += l[i];
      if (flag[i] > 0) tmp += 10;
    }
    tmp += abs(sum[1] - A) + abs(sum[2] - B) + abs(sum[3] - C);
    if (tmp < min) min = tmp;
    while (1) {
      for (i = 1; i <= N && flag[i] == 3; i++)
        ;
      for (flag[i--]++; i >= 1; flag[i--] = 0)
        ;
      for (i = 1; i <= N; i++)
        if (flag[i] == 1) break;
      if (i > N) continue;
      for (i = 1; i <= N; i++)
        if (flag[i] == 2) break;
      if (i > N) continue;
      for (i = 1; i <= N; i++)
        if (flag[i] == 3) break;
      if (i <= N) break;
    }
  }
  printf("%d\n", min);
  fflush(stdout);
  return 0;
}
