#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(9);
  int N;
  cin >> N;
  int A, B, C;
  cin >> A >> B >> C;
  int L[9];
  for (int i = 0; i < N; i++) cin >> L[i];
  L[N] = 0;
  int ans = 2147483647;
  int tmp = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= N; j++) {
      tmp += abs(L[i] + L[j] - A);
      if (j != N) tmp += 10;
      for (int k = 0; k < N; k++) {
        for (int l = 0; l <= N; l++) {
          tmp += abs(L[k] + L[l] - B);
          if (l != N) tmp += 10;
          for (int m = 0; m < N; m++) {
            for (int n = 0; n <= N; n++) {
              tmp += abs(L[m] + L[n] - C);
              if (n != N) tmp += 10;
              int a[6] = {i, j, k, l, m, n};
              sort(a, a + 6);
              bool flg = true;
              for (int o = 1; o < 6; o++) {
                if (a[o] != N && a[o] == a[o - 1]) flg = false;
              }
              if (flg) ans = min(ans, tmp);
              tmp -= abs(L[m] + L[n] - C);
              if (n != N) tmp -= 10;
            }
          }
          tmp -= abs(L[k] + L[l] - B);
          if (l != N) tmp -= 10;
        }
      }
      tmp -= abs(L[i] + L[j] - A);
      if (j != N) tmp -= 10;
    }
  }
  cout << ans << endl;
  return 0;
}
