#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long Hashimoto = 0;
  bool Kanna = 1;
  char I_Love = getchar();
  while (I_Love < '0' || I_Love > '9') {
    if (I_Love == '-') Kanna = 0;
    I_Love = getchar();
  }
  while (I_Love >= '0' && I_Love <= '9') {
    Hashimoto = Hashimoto * 10 + I_Love - '0';
    I_Love = getchar();
  }
  return (Kanna ? Hashimoto : -Hashimoto);
}
template <typename T1, typename T2>
inline void Umax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <typename T1, typename T2>
inline void Umin(T1 &a, T2 b) {
  if (a > b) a = b;
}
int n;
int a, b, c;
int l[8];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int ans = (1000000000);
  cin >> n >> a >> b >> c;
  for (int i = 0; i < (n); ++i) cin >> l[i];
  for (int m1 = 1; m1 < ((1 << n)); ++m1)
    for (int m2 = 1; m2 < ((1 << n)); ++m2)
      if ((m1 & m2) == 0)
        for (int m3 = 1; m3 < ((1 << n)); ++m3)
          if ((m1 & m3) == 0 && (m2 & m3) == 0) {
            int x, y, z;
            x = y = z = 0;
            for (int i = 0; i < (n); ++i) {
              if (m1 & (1 << i)) x += l[i];
              if (m2 & (1 << i)) y += l[i];
              if (m3 & (1 << i)) z += l[i];
            }
            Umin(ans, __builtin_popcount(m1) * 10 +
                          __builtin_popcount(m2) * 10 +
                          __builtin_popcount(m3) * 10 - 3 * 10 + abs(a - x) +
                          abs(y - b) + abs(z - c));
            if (ans == 0) {
              cout << x << " " << y << " " << z << endl;
            }
          }
  cout << ans << endl;
  return 0;
}
