#include <bits/stdc++.h>
int N, A, B, C;
int l[8];
int dfs(int i, int a, int b, int c) {
  if (i == N) return a & b & c ? abs(A - a) + abs(B - b) + abs(C - c) : 1 << 30;
  int ret = 1 << 30;
  ret = std::min(ret, dfs(i + 1, a, b, c));
  ret = std::min(ret, dfs(i + 1, a + l[i], b, c) + (a ? 10 : 0));
  ret = std::min(ret, dfs(i + 1, a, b + l[i], c) + (b ? 10 : 0));
  ret = std::min(ret, dfs(i + 1, a, b, c + l[i]) + (c ? 10 : 0));
  return ret;
}
int main() {
  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));
  return 0;
}
