#include <bits/stdc++.h>
int n, A, B, C;
int l[8];
int max = 1001;
int MIN(int a, int b) { return a < b ? a : b; };
int dfs(int cur, int a, int b, int c, int ta, int tb, int tc) {
  if (cur == n) {
    if (ta * tb * tc == 0) {
      return max;
    }
    return abs(A - a) + abs(B - b) + abs(C - c) +
           10 * ((ta - 1) + (tb - 1) + (tc - 1));
  }
  int ret0 = dfs(cur + 1, a, b, c, ta, tb, tc);
  int ret1 = dfs(cur + 1, a + l[cur], b, c, ta + 1, tb, tc);
  int ret2 = dfs(cur + 1, a, b + l[cur], c, ta, tb + 1, tc);
  int ret3 = dfs(cur + 1, a, b, c + l[cur], ta, tb, tc + 1);
  return MIN(ret3, MIN(ret2, MIN(ret0, ret1)));
}
int main(void) {
  scanf("%d%d%d%d", &n, &A, &B, &C);
  for (int i = 0; i < n; i++) {
    scanf("%d", &l[i]);
  }
  printf("%d\n", dfs(0, 0, 0, 0, 0, 0, 0));
  return 0;
}
