#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;
using namespace std;
int main() {
  ll N;
  cin >> N;
  vector<ll> ls(N);
  ll A, B, C;
  cin >> A >> B >> C;
  ll take_obj[3] = {A, B, C};
  for (auto i = 0; i < N; i++) cin >> ls[i];
  ll beki4 = 1;
  ll res = 1000000000000;
  for (auto i = 0; i < N; i++) beki4 *= 4;
  for (auto i = 0; i < beki4; i++) {
    ll bits = i;
    ll mp = 0;
    ll take[3] = {0, 0, 0};
    for (auto j = 0; bits > 0; bits /= 4, j++) {
      ll k = bits % 4;
      if (k == 3) continue;
      if (take[k] > 0) mp += 10;
      take[k] += ls[j];
    }
    if (take[0] == 0 || take[1] == 0 || take[2] == 0) continue;
    for (auto j = 0; j < 3; j++) mp += abs(take_obj[j] - take[j]);
    if (res > mp) {
    }
    res = min(res, mp);
  }
  cout << res << endl;
  return 0;
}
