#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const long long INF = (long long)1e18 + 7;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
long long N, A, B, C;
vector<long long> l;
long long ans = INF;
void calc(vector<long long> v) {
  long long tmp = 0;
  long long a = 0, b = 0, c = 0;
  long long cnt[3] = {0};
  for (long long i = 0; i < N; i++) {
    if (v[i] == 0) {
      a += l[i];
      cnt[0]++;
    } else if (v[i] == 1) {
      b += l[i];
      cnt[1]++;
    } else if (v[i] == 2) {
      c += l[i];
      cnt[2]++;
    }
  }
  for (long long i = 0; i < 3; i++) {
    if (cnt[i] >= 2) {
      tmp += (cnt[i] - 1) * 10;
    }
  }
  tmp += abs(A - a) + abs(B - b) + abs(C - c);
  ans = min(ans, tmp);
  return;
}
void dfs(long long depth, vector<long long> v) {
  if (depth == N) {
    calc(v);
    return;
  }
  for (long long i = 0; i < 4; i++) {
    v[depth] = i;
    dfs(depth + 1, v);
  }
  return;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  cin >> A >> B >> C;
  l.resize(N);
  for (long long i = 0; i < N; i++) {
    cin >> l[i];
  }
  vector<long long> v(N);
  dfs(0, v);
  cout << ans << endl;
  return 0;
}
