#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, m = 1000000000;
  cin >> n >> a >> b >> c;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i < pow(4, n); ++i) {
    int ta = 0, tb = 0, tc = 0, tm = 0, tmp = i;
    for (int j = 0; j < n; ++j) {
      if (tmp % 4 == 1) {
        if (ta != 0) tm += 10;
        ta += v[j];
      } else if (tmp % 4 == 2) {
        if (tb != 0) tm += 10;
        tb += v[j];
      } else if (tmp % 4 == 3) {
        if (tb != 0) tm += 10;
        tc += v[j];
      }
      tmp /= 4;
    }
    if (ta == 0 || tb == 0 || tc == 0)
      continue;
    else {
      tm += abs(ta - a) + abs(tb - b) + abs(tc - c);
      m = min(m, tm);
    }
  }
  cout << m << endl;
  return 0;
}
