#include <bits/stdc++.h>
using namespace std;
const char sp = ' ';
const int MOD = 1000000007;
using ll = long long;
ll mod(ll a, ll b) { return (a % b + b) % b; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void Judge(bool b) { b ? Yes() : No(); }
void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void JUDGE(bool b) { b ? YES() : NO(); }
ll powMod(ll b, ll e, ll m) {
  ll r = 1;
  while (e > 0) {
    if (e & 1) r = (r % m) * (b % m) % m;
    b = (b % m) * (b % m) % m;
    e >>= 1;
  }
  return r;
}
double distance(ll x1, ll y1, ll x2, ll y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
template <typename T>
void ppp(T n) {
  cout << n << endl;
}
vector<string> split(const string &str, char sep) {
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep)) {
    v.push_back(buffer);
  }
  return v;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < (n); ++i) {
    cin >> l[i];
  }
  int close = INT_MAX;
  int mp = INT_MAX;
  for (int i = 0; i < static_cast<int>(pow(4, n + 1)); ++i) {
    int tmpa = 0, tmpb = 0, tmpc = 0;
    int cnta = 0, cntb = 0, cntc = 0;
    int tmp = 0;
    for (int j = 0; j < n; ++j) {
      if ((i / static_cast<int>(pow(4, j + 1))) % 4 == 0) {
        tmpa += l[j];
        ++cnta;
      } else if ((i / static_cast<int>(pow(4, j + 1))) % 4 == 1) {
        tmpb += l[j];
        ++cntb;
      } else if ((i / static_cast<int>(pow(4, j + 1))) % 4 == 2) {
        tmpc += l[j];
        ++cntc;
      }
    }
    tmp = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc);
    mp = min(mp, tmp + 10 * max(cnta - 1, 0) + 10 * max(cntb - 1, 0) +
                     10 * max(cntc - 1, 0));
  }
  ppp(mp);
  return 0;
}
