#include <bits/stdc++.h>
using namespace std;
int ans = 1e9;
void calc(vector<int> v, vector<int> l, int a, int b, int c) {
  int sumA, sumB, sumC, cost, cntA, cntB, cntC;
  sumA = sumB = sumC = cost = cntA = cntB = cntC = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] == 3) continue;
    if (v[i] == 0) {
      sumA += l[i];
      cntA++;
    }
    if (v[i] == 1) {
      sumB += l[i];
      cntB++;
    }
    if (v[i] == 2) {
      sumC += l[i];
      cntC++;
    }
  }
  if (sumA == 0 || sumB == 0 || sumC == 0) return;
  cost += 10 * (max(cntA - 1, 0) + max(cntB - 1, 0) + max(cntC - 1, 0));
  cost += abs(sumA - a);
  cost += abs(sumB - b);
  cost += abs(sumC - c);
  if (cost == 120)
    for (int i = 0; i < v.size(); i++) cout << v[i] << endl;
  ans = min(ans, cost);
}
void dfs(int depth, vector<int> v, vector<int> l, int a, int b, int c) {
  if (depth == v.size()) {
    calc(v, l, a, b, c);
    return;
  }
  for (int i = 0; i < 4; i++) {
    v[depth] = i;
    dfs(depth + 1, v, l, a, b, c);
  }
}
int main(void) {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n), v(n);
  for (int i = 0; i < n; i++) cin >> l[i];
  dfs(0, v, l, a, b, c);
  cout << ans << endl;
  return 0;
}
