#include <bits/stdc++.h>
using namespace std;
bool check(int a, int b) { return a > b; }
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int xa, xb, xc;
  int tmp;
  int cnt;
  int min = 114514;
  for (int i = 0; i < pow(4, n); i++) {
    xa = 0;
    xb = 0;
    xc = 0;
    tmp = i;
    cnt = 0;
    for (int j = 0; j < n; j++) {
      if (tmp % 4 == 0) {
        if (xa != 0) {
          cnt += 10;
        }
        xa += x[j];
      }
      if (tmp % 4 == 1) {
        if (xb != 0) {
          cnt += 10;
        }
        xb += x[j];
      }
      if (tmp % 4 == 2) {
        if (xc != 0) {
          cnt += 10;
        }
        xc += x[j];
      }
      tmp /= 4;
      if (tmp == 0) {
        break;
      }
    }
    if (xa == 0 || xb == 0 || xc == 0) {
      continue;
    }
    cnt += abs(a - xa) + abs(b - xb) + abs(c - xc);
    if (min > cnt) {
      min = cnt;
    }
  }
  cout << min << endl;
  return 0;
}
