#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void) {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> l[i];
  for (ll i = 0; i < pow(4, N); i++) {
    ll qq = i;
    vector<int> useA, useB, useC;
    for (int j = 0; j < N; j++) {
      int use = qq % 4;
      qq /= 4;
      switch (use) {
        case 1:
          useA.push_back(l[j]);
          break;
        case 2:
          useB.push_back(l[j]);
          break;
        case 3:
          useC.push_back(l[j]);
          break;
        default:
          break;
      }
    }
    if (useA.size() == 0) continue;
    if (useB.size() == 0) continue;
    if (useC.size() == 0) continue;
    int aa = 0, bb = 0, cc = 0;
    int mpA = 0, mpB = 0, mpC = 0;
    for (int j = 0; j < useA.size(); j++) aa += useA[j];
    mpA += (useA.size() - 1) * 10;
    for (int j = 0; j < useB.size(); j++) bb += useB[j];
    mpB += (useB.size() - 1) * 10;
    for (int j = 0; j < useC.size(); j++) cc += useC[j];
    mpC += (useC.size() - 1) * 10;
    mpA += abs(aa - A);
    mpB += abs(bb - B);
    mpC += abs(cc - C);
    int cost = mpA + mpB + mpC;
    if (i == 0)
      ans = cost;
    else
      ans = (ans < cost) ? ans : cost;
  }
  cout << ans << endl;
  return 0;
}
