#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
long long N, A[3];
long long L[8];
signed main() {
  cin >> N;
  for (long long i = 0; i < (3); i++) cin >> A[i];
  for (long long i = 0; i < (N); i++) cin >> L[i];
  long long ans = 1001001001;
  for (long long i = 0; i < (1 << (2 * N)); i++) {
    long long sum[4] = {};
    long long cost = -30;
    for (long long j = 0; j < (N); j++) {
      sum[i >> (2 * j) & 3] += L[j];
      if ((i >> (2 * j) & 3) != 3) cost += 10;
    }
    for (long long j = 0; j < (3); j++) cost += abs(sum[j] - A[j]);
    chmin(ans, cost);
  }
  cout << ans << endl;
}
