#include <bits/stdc++.h>
int rec(int N, int i, const std::vector<int>& L, int a, int b, int c, int A,
        int B, int C) {
  if (i >= N - 1) {
    if (a == 0 || b == 0 || c == 0) return 99999999;
    return std::abs(a - A) + std::abs(b - B) + std::abs(c - C) - 30;
  }
  int r0 = rec(N, i + 1, L, a, b, c, A, B, C);
  int r1 = rec(N, i + 1, L, a + L[i], b, c, A, B, C) + 10;
  int r2 = rec(N, i + 1, L, a, b + L[i], c, A, B, C) + 10;
  int r3 = rec(N, i + 1, L, a, b, c + L[i], A, B, C) + 10;
  return std::min({r0, r1, r2, r3});
}
int main() {
  int N, A, B, C;
  std::cin >> N >> A >> B >> C;
  std::vector<int> L(N);
  for (int i = 0; i < N; i++) std::cin >> L[i];
  int ans = rec(N, 0, L, 0, 0, 0, A, B, C);
  std::cout << ans << std::endl;
  return 0;
}
