#include <bits/stdc++.h>
using namespace std;
int A, B, C, N;
int banboo[10000];
int dfs(int l, int a, int b, int c) {
  int r1, r2, r3, r4;
  if (l == N) {
    if (a == 0 || b == 0 || c == 0) return 8001;
    return abs(A - a) + abs(B - b) + abs(C - c);
  }
  r1 = dfs(l + 1, banboo[l + 1] + a, b, c);
  r2 = dfs(l + 1, a, banboo[l + 1] + b, c);
  r3 = dfs(l + 1, a, b, banboo[l + 1] + c);
  r4 = dfs(l + 1, a, b, c);
  return min(min(r1, r2), min(r3, r4));
}
int main() {
  scanf("%d %d %d %d", &N, &A, &B, &C);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &banboo[i]);
  }
  printf("%d", dfs(0, 0, 0, 0));
  return 0;
}
