#include <bits/stdc++.h>
using namespace std;
long long day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
struct edge {
  long long to, cost;
};
bool isupper(char c) {
  if ('A' <= c && c <= 'Z') return 1;
  return 0;
}
bool islower(char c) {
  if ('a' <= c && c <= 'z') return 1;
  return 0;
}
bool isPrime(long long x) {
  if (x == 1) return 0;
  if (x == 2) return 1;
  if (x % 2 == 0) return 0;
  for (long long i = 3; i * i <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
bool iskaibun(string s) {
  for (long long i = 0; i < s.size() / 2; i++)
    if (s[i] != s[s.size() - i - 1]) return 0;
  return 1;
}
bool isnumber(char c) { return ('0' <= c && c <= '9'); }
bool isalpha(char c) { return (isupper(c) && islower(c)); }
void print(vector<long long> v) {
  for (long long i = (long long)0; i < (long long)v.size(); i++) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
struct S {
  long long number;
  long long AC[10] = {}, WA[10] = {}, time = 0;
  long long sumAC = 0;
};
bool cmp(S a, S b) {
  if (a.sumAC == b.sumAC) {
    if (a.time == b.time) return a.number > b.number;
    return a.time < b.time;
  }
  return a.sumAC > b.sumAC;
}
signed main() {
  long long n;
  vector<long long> a(3);
  cin >> n;
  for (long long i = (long long)0; i < (long long)3; i++) cin >> a[i];
  vector<long long> v(n);
  for (long long i = (long long)0; i < (long long)n; i++) cin >> v[i];
  sort((v).begin(), (v).end());
  sort((a).begin(), (a).end());
  long long ans = 1e9;
  for (long long p = 1; p < (1 << n); p++) {
    vector<long long> V;
    for (long long q = 0; q < n; q++) {
      if (p >> q & 1) V.push_back(v[q]);
    }
    sort((V).begin(), (V).end());
    do {
      vector<long long> tempv = V;
      long long sz = tempv.size();
      for (long long i = (long long)1; i < (long long)sz; i++)
        tempv[i + 1] += tempv[i];
      for (long long i = 0; i < sz - 2; i++) {
        for (long long j = i + 1; j < sz - 1; j++) {
          ans = min(ans, abs(tempv[i] - a[0]) +
                             abs((tempv[j] - tempv[i]) - a[1]) +
                             abs((tempv[sz - 1] - tempv[j]) - a[2]) + 10LL * i +
                             10LL * (j - i - 1) + 10LL * (n - j - 1 - 1));
        }
      }
    } while (next_permutation((V).begin(), (V).end()));
  }
  cout << ans << endl;
}
