#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, l[10], gl[10], buf[4];
int main() {
  cin >> n >> a >> b >> c;
  for (long long i = 1; i <= n; i++) {
    cin >> l[i];
  }
  long long ans = a + b + c;
  for (long long bit = 0; bit < (1 << 2 * n); bit++) {
    for (long long i = 1; i <= n; i++) {
      if (bit & (1 << 2 * i - 2) && bit & (1 << 2 * i - 1)) {
        gl[i] = 3;
      }
      if (bit & (1 << 2 * i - 2) && !(bit & (1 << 2 * i - 1))) {
        gl[i] = 1;
      }
      if (!(bit & (1 << 2 * i - 2)) && bit & (1 << 2 * i - 1)) {
        gl[i] = 2;
      }
      if (!(bit & (1 << 2 * i - 2)) && !(bit & (1 << 2 * i - 1))) {
        gl[i] = 0;
      }
    }
    long long mp = -30;
    long long check = 0;
    memset(buf, 0, sizeof(buf));
    for (long long i = 1; i <= n; i++) {
      buf[gl[i]] += l[i];
      if (gl[i] <= 2) {
        mp += 10;
        check |= (1 << gl[i]);
      }
    }
    sort(buf, buf + 3);
    mp += abs(c - buf[0]);
    mp += abs(b - buf[1]);
    mp += abs(a - buf[2]);
    if (check == (1 << 3) - 1) {
      ans = min(mp, ans);
    }
  }
  cout << ans << endl;
  return 0;
}
