#include <bits/stdc++.h>
using namespace std;
vector<int> l;
int n, a, b, c;
int func(int i, int aa, int bb, int cc) {
  int res;
  if (i == n) {
    if (!a || !b || !c)
      res = 1e09;
    else
      res = abs(aa - a) + abs(bb - b) + abs(cc - c);
  } else {
    res = func(i + 1, aa, bb, cc);
    res = (res < func(i + 1, aa + l[i], bb, cc) + (aa > 0 ? 10 : 0)
               ? res
               : func(i + 1, aa + l[i], bb, cc) + (aa > 0 ? 10 : 0));
    res = (res < func(i + 1, aa, bb + l[i], cc) + (bb > 0 ? 10 : 0)
               ? res
               : func(i + 1, aa, bb + l[i], cc) + (bb > 0 ? 10 : 0));
    res = (res < func(i + 1, aa, bb, cc + l[i]) + (cc > 0 ? 10 : 0)
               ? res
               : func(i + 1, aa, bb, cc + l[i]) + (cc > 0 ? 10 : 0));
  }
  return res;
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    l.push_back(k);
  }
  cout << func(0, 0, 0, 0) << endl;
}
