#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, orig_a, orig_b, orig_c;
  cin >> n >> orig_a >> orig_b >> orig_c;
  int L[n];
  for (int i = 0; i < n; ++i) {
    cin >> L[i];
  }
  sort(L, L + n);
  int min_m = 8001;
  do {
    int a = orig_a;
    int b = orig_b;
    int c = orig_c;
    int m = 0;
    int i = 0;
    bool a_second = false;
    for (; i < n; ++i) {
      if (a <= abs(a - L[i]) && a_second) {
        m += a;
        a = 0;
        break;
      }
      if (a_second) m += 10;
      if (a <= L[i]) {
        m += L[i] - a;
        i++;
        a = 0;
        break;
      }
      a -= L[i];
      a_second = true;
    }
    bool b_second = false;
    if (a > 0) m += a;
    for (; i < n; ++i) {
      if (b <= abs(b - L[i]) && b_second) {
        m += b;
        b = 0;
        break;
      }
      if (b_second) m += 10;
      if (b <= L[i]) {
        m += L[i] - b;
        b = 0;
        i++;
        break;
      }
      b -= L[i];
      b_second = true;
    }
    if (b > 0) m += b;
    bool c_second = false;
    for (; i < n; ++i) {
      if (c <= abs(c - L[i]) && c_second) {
        m += c;
        c = 0;
        break;
      }
      if (c_second) m += 10;
      if (c <= L[i]) {
        m += L[i] - c;
        c = 0;
        break;
      }
      c -= L[i];
      m += 10;
      c_second = true;
    }
    if (c > 0) m += c;
    min_m = min(min_m, m);
  } while (next_permutation(L, L + n));
  cout << min_m << '\n';
  return 0;
}
