#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l.at(i);
  }
  int quat;
  int minMp = 1000;
  for (int i = 0; i < pow(4, n); i++) {
    vector<int> matu(4);
    int sum = 0;
    for (int j = 0; j < n; j++) {
      quat = 0;
      if (i & (1 << (j * 2))) {
        quat++;
      }
      if (i & (1 << ((j * 2) + 1))) {
        quat += 2;
      }
      if ((matu.at(quat) != 0) && (quat != 3)) {
        sum += 10;
      }
      matu.at(quat) += l.at(j);
    }
    if ((matu.at(0) == 0) || (matu.at(1) == 0) || (matu.at(2) == 0)) {
      continue;
    }
    sum += abs(a - matu.at(0)) + abs(b - matu.at(1)) + abs(c - matu.at(2));
    if (minMp > sum) {
      minMp = sum;
    }
  }
  cout << minMp << endl;
}
