#include <bits/stdc++.h>
using ll = unsigned long long;
using namespace std;
void chmin(int &a, int b) {
  if (a > b) {
    a = b;
  }
}
int rec(int i, int a, int b, int c, const int n, const int ca, const int cb,
        const int cc, int *l) {
  if (i == n) {
    if (!a || !b || !c) {
      return INT32_MAX;
    }
    return abs(a - ca) + abs(b - cb) + abs(c - cc);
  }
  int res = rec(i + 1, a, b, c, n, ca, cb, cc, l);
  chmin(res, rec(i + 1, a + l[i], b, c, n, ca, cb, cc, l) + (a ? 10 : 0));
  chmin(res, rec(i + 1, a, b + l[i], c, n, ca, cb, cc, l) + (b ? 10 : 0));
  chmin(res, rec(i + 1, a, b, c + l[i], n, ca, cb, cc, l) + (c ? 10 : 0));
  return res;
}
int main(void) {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int *l = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> l[i];
  }
  cout << rec(0, 0, 0, 0, n, a, b, c, l) << endl;
  return 0;
}
