#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;
long long int l[8];
int main(void) {
  long long int n, a, b, c;
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  long long int ans = INF;
  int s = (1 << n) - 1;
  int sa = s;
  do {
    long long int ta = 0;
    int ca = 0;
    for (int i = 0; i < n; i++)
      if ((sa >> i) & 1) {
        ta += l[i];
        ca++;
      }
    ta = (ca - 1) * 10 + abs(ta - a);
    int sb = s - sa;
    do {
      if (sb == 0) break;
      long long int tb = ta;
      int cb = 0;
      long long int bb = 0;
      for (int i = 0; i < n; i++)
        if ((sb >> i) & 1) {
          bb += l[i];
          cb++;
        }
      tb += (cb - 1) * 10 + abs(bb - b);
      int sc = s - sa - sb;
      do {
        if (sc == 0) break;
        long long int tc = tb;
        int cc = 0;
        long long int ccc = 0;
        for (int i = 0; i < n; i++)
          if ((sc >> i) & 1) {
            ccc += l[i];
            cc++;
          }
        ans = min(ans, tc + (cc - 1) * 10 + abs(ccc - c));
        sc = (sc - 1) & (s - sa - sb);
      } while (sc != s - sa - sb);
      sb = (sb - 1) & (s - sa);
    } while (sb != s - sa);
    sa = (sa - 1) & s;
  } while (sa != s);
  cout << ans << endl;
  return 0;
}
