#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B>
bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
long long inf = sizeof(long long) == sizeof(long long) ? 2e18 : 1e9 + 10;
long long n, out = inf;
vector<long long> in, co;
long long w[3];
void f(long long q) {
  if (q == n) {
    long long sum = 0;
    for (long long i = 0; i < 3; i++) {
      long long c = 0, s = 0;
      for (long long j = 0; j < n; j++)
        if (co[j] == i) c++, s += in[j];
      sum += abs(w[i] - s) + 10 * max(c - 1, 0ll);
    }
    cmin(out, sum);
  } else {
    co[q] = 0;
    f(q + 1);
    co[q] = 1;
    f(q + 1);
    co[q] = 2;
    f(q + 1);
    co[q] = 3;
    f(q + 1);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> w[0] >> w[1] >> w[2];
  in = co = vector<long long>(n);
  for (long long i = 0; i < n; i++) cin >> in[i];
  f(0);
  cout << out << endl;
}
