#include <bits/stdc++.h>
using namespace std;
int N, A, B, C, l[8] = {};
long long mpsum, mpmin = 9999999999;
void calc(vector<int> v) {
  int num[4] = {};
  int a = 0, b = 0, c = 0;
  for (int i = 0; i < N; i++) {
    num[v[i]] += 1;
    if (v[i] == 1) a += l[i];
    if (v[i] == 2) b += l[i];
    if (v[i] == 3) c += l[i];
  }
  if (num[1] != 0 && num[2] != 0 && num[3] != 0) {
    mpsum = (abs(A - a) + abs(B - b) + abs(C - c) +
             (num[1] + num[2] + num[3] - 3) * 10);
    if (mpsum < mpmin) mpmin = mpsum;
  }
}
void dfs(int depth, vector<int> v) {
  if (depth == N)
    calc(v);
  else {
    for (int i = 0; i < 4; i++) {
      v.push_back(i);
      dfs(depth + 1, v);
    }
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> l[i];
  vector<int> v;
  dfs(0, v);
  cout << mpmin << endl;
  return 0;
}
