#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
int N, A, B, C;
vector<int> l;
int ans = 2e9;
void calc(int &s, vector<int> &now) {
  vector<int> nowA, nowB, nowC;
  int sumA = 0, sumB = 0, sumC = 0;
  for (int i = (int)(0); i < (int)(N); i++) {
    if (now[i] == 1) {
      nowA.push_back(l[i]);
      sumA += l[i];
    }
    if (now[i] == 2) {
      nowB.push_back(l[i]);
      sumB += l[i];
    }
    if (now[i] == 3) {
      nowC.push_back(l[i]);
      sumC += l[i];
    }
  }
  if (nowA.size() >= 1 && nowB.size() >= 1 && nowC.size() >= 1)
    s += (nowA.size() + nowB.size() + nowC.size() - 3) * 10 + abs(sumA - A) +
         abs(sumB - B) + abs(sumC - C);
}
void dfs(int depth, vector<int> &now) {
  if (depth == N) {
    int s = 0;
    calc(s, now);
    if (s != 0) ans = min(ans, s);
    return;
  }
  for (int i = (int)(0); i < (int)(4); i++) {
    now[depth] = i;
    dfs(depth + 1, now);
  }
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = (int)(0); i < (int)(N); i++) cin >> l[i];
  vector<int> now(N);
  dfs(0, now);
  cout << ans << endl;
}
