#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1 << 29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int N, A, B, C;
vector<int> L;
int dfs(int cur, int a, int b, int c) {
  if (cur == N) {
    if (min({(a, b, c)}) <= 0) {
      return INF;
    } else {
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }
  }
  int ret0 = dfs(cur + 1, a, b, c);
  int ret1 = dfs(cur + 1, a + L[cur], b, c) + 10;
  int ret2 = dfs(cur + 1, a, b + L[cur], c) + 10;
  int ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10;
  return min({ret0, ret1, ret2, ret3});
}
void solve() {
  cin >> N;
  cin >> A >> B >> C;
  L.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return;
}
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(int args, char* argv[]) { solve(); }
