#include <bits/stdc++.h>
int L[8];
int min(int a, int b) {
  if (a > b)
    return b;
  else
    return a;
}
int dfs(int a, int b, int c, int d, int N, int A, int B, int C) {
  if (d == N) return (abs(a - A) + abs(b - B) + abs(c - C) - 30);
  int ret0 = dfs(a + L[d], b, c, d + 1, N, A, B, C) + 10;
  int ret1 = dfs(a, b + L[d], c, d + 1, N, A, B, C) + 10;
  int ret2 = dfs(a, b, c + L[d], d + 1, N, A, B, C) + 10;
  int ret3 = dfs(a, b, c, d + 1, N, A, B, C);
  return min(min(ret0, ret1), min(ret2, ret3));
}
int main() {
  int i, j, k = 0;
  int N, A, B, C;
  scanf("%d %d %d %d", &N, &A, &B, &C);
  for (i = 0; i < N; i++) {
    scanf("%d", &L[i]);
  }
  printf("%d\n", dfs(0, 0, 0, 0, N, A, B, C));
  return 0;
}
