#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const long long mod = 1e9 + 7;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
long long calc(long long a, long long b, long long c, long long n,
               vector<long long> l) {
  long long ans = 0;
  if (a > 0) {
    long long mi = 1000000000000000000LL, bi;
    for (int bit = 0; bit < (1 << n); ++bit) {
      long long sum = 0, num = 0;
      for (int i = 0; i < n; ++i) {
        if (bit & (1 << i)) {
          sum += l[i];
          num++;
        }
      }
      if (sum != 0) {
        if (mi > abs(a - sum) + ((num - 1) * 10)) {
          bi = bit;
          mi = abs(a - sum) + ((num - 1) * 10);
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      if (bi & (1 << i)) {
        l.erase(l.begin() + i);
        n--;
      }
    }
    ans += mi;
  }
  if (c > 0) {
    long long mi = 1000000000000000000LL, bi;
    for (int bit = 0; bit < (1 << n); ++bit) {
      long long sum = 0, num = 0;
      for (int i = 0; i < n; ++i) {
        if (bit & (1 << i)) {
          sum += l[i];
          num++;
        }
      }
      if (sum != 0) {
        if (mi > abs(c - sum) + ((num - 1) * 10)) {
          bi = bit;
          mi = abs(c - sum) + ((num - 1) * 10);
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      if (bi & (1 << i)) {
        l.erase(l.begin() + i);
        n--;
      }
    }
    ans += mi;
  }
  if (b > 0) {
    long long mi = 1000000000000000000LL, bi;
    for (int bit = 0; bit < (1 << n); ++bit) {
      long long sum = 0, num = 0;
      for (int i = 0; i < n; ++i) {
        if (bit & (1 << i)) {
          sum += l[i];
          num++;
        }
      }
      if (sum != 0) {
        if (mi > abs(b - sum) + ((num - 1) * 10)) {
          bi = bit;
          mi = abs(b - sum) + ((num - 1) * 10);
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      if (bi & (1 << i)) {
        l.erase(l.begin() + i);
        n--;
      }
    }
    ans += mi;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, a, b, c, ans = 0;
  while (cin >> n >> a >> b >> c) {
    ans = 0;
    vector<long long> l;
    for (int i = 0; i < n; ++i) {
      long long x;
      cin >> x;
      if (x == a)
        a = 0, n--;
      else if (x == b)
        b = 0, n--;
      else if (x == c)
        c = 0, n--;
      else
        l.push_back(x);
    }
    sort((l).begin(), (l).end());
    vector<long long> x(6);
    x[0] = calc(a, b, c, n, l);
    x[1] = calc(a, c, b, n, l);
    x[2] = calc(b, a, c, n, l);
    x[3] = calc(b, c, a, n, l);
    x[4] = calc(c, a, b, n, l);
    x[5] = calc(c, b, a, n, l);
    sort((x).begin(), (x).end());
    cout << x[0] << endl;
  }
  return 0;
}
