#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, num, A, B, C, res = LLONG_MAX;
vector<ll> vec;
ll recursion(ll i, ll a, ll b, ll c, ll cost) {
  if (i == N) {
    if (!a || !b || !c)
      return LLONG_MAX;
    else
      return abs(a - A) + abs(b - B) + abs(c - C) + cost;
  }
  ll ret0 = recursion(i + 1, a, b, c, cost);
  ll ret1 = recursion(i + 1, a + vec[i], b, c, cost + ((a == 0) ? 0 : 10));
  ll ret2 = recursion(i + 1, a, b + vec[i], c, cost + ((b == 0) ? 0 : 10));
  ll ret3 = recursion(i + 1, a, b, c + vec[i], cost + ((c == 0) ? 0 : 10));
  return min({ret0, ret1, ret2, ret3});
}
int main() {
  cin >> N >> A >> B >> C;
  vec.resize(N);
  for (ll i = 0; i < N; i++) cin >> vec[i];
  cout << recursion(0, 0, 0, 0, 0) << "\n";
  return 0;
}
