#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void chmin(ll &a, ll b) {
  if (a > b) a = b;
}
const int mod = 1000000007;
const int INF = 1e+9;
ll n, A, B, C;
vector<ll> l(n + 5);
ll dfs(ll cur, ll a, ll b, ll c) {
  if (cur == n) {
    if (!a || !b || !c) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  ll res = dfs(cur + 1, a, b, c);
  chmin(res, dfs(cur + 1, a + l[cur], b, c) + (a ? 10 : 0));
  chmin(res, dfs(cur + 1, a, b + l[cur], c) + (b ? 10 : 0));
  chmin(res, dfs(cur + 1, a, b, c + l[cur]) + (c ? 10 : 0));
  return res;
}
int main() {
  cin >> n >> A >> B >> C;
  for (int i = 0; i < n; i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
}
