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