#include <bits/stdc++.h>

using namespace std;

int N, A, B, C;
vector<int> L;

int solve(int n, int a, int b, int c) {
  if (n == N) {
    if (a == 0 or b == 0 or c == 0) {
      return 1e9;
    }
    return abs(A - a) + abs(B - b) + abs(C - c) - 30;
  }
  int s1 = solve(n + 1, a, b, c);
  int s2 = solve(n + 1, a + L[n], b, c) + 10;
  int s3 = solve(n + 1, a, b + L[n], c) + 10;
  int s4 = solve(n + 1, a, b, c + L[n]) + 10;
  return min(s1, min(s2, min(s3, s4)));
}

int main() {
  cin >> N >> A >> B >> C;
  L.resize(N);
  for (auto &l : L) cin >> l;
  cout << solve(0, 0, 0, 0) << endl;

  return 0;
}
/* vim:set fdm=marker: */
