// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define int long long

#define vvi vector<vector<int>>

#define vec vector

#define pq priority_queue

#define all(v) (v).begin(), (v).end()

#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());

#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))

#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))

#define dbg(x) cerr << #x << ": " << x << endl;

#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;

#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;

#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;

#define line() cerr << "---------------" << endl;



const int dx[] = {1, -1, 0, 0};

const int dy[] = {0, 0, -1, 1};

const double PI = 3.14159265358979323846;



template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }



template<typename T>

void print1(T begin, T end) {

  while (begin != end) {

    cout << (*begin) << " ";

    *begin++;

  }

  cout << endl;

}



template<typename T>

void print2(T Array, int height, int width) {

  for (int i = 0; i < height; i++) {

    for (int j = 0; j < width; j++) {

      cout << " " << Array[i][j];

    }

    cout << endl;

  }

}



void print() { std::cerr << endl; }

template <class Head, class... Tail>

void print(Head&& head, Tail&&... tail) {

  std::cerr << head << " ";

  print(std::forward<Tail>(tail)...);

}



template<class T>

void Add(T &a, const T &b, const T &mod=1000000007) {

  int val = ((a % mod) + (b % mod)) % mod;

  if (val < 0) { val += mod; }

  a = val;

}



// ------------------------------------------------------------------------------------------



const int INF = 1e18;



int N, A, B, C;

vec<int> l;



int calc2(vector<int> v, int val) {

  int n = v.size();

  int ret = INF;



  for (int mask = 0; mask < (1LL<<n); mask++) {

    int tmp = 0;

    int cnt = 0;

    vec<int> t;

    for (int i = 0; i < n; i++) {

      if (mask & (1LL << i)) {

        tmp += v[i];

        cnt++;

        t.push_back(v[i]);

      }

    }

    if (cnt == 0) continue;



    // dbg(tmp)

    int update = (cnt-1)*10 + abs(val - tmp);

    chmin(ret, update);

  }



  return ret;

}



int calc(vec<int> a, vec<int> b, vec<int> c) {

  // print1(all(a));

  int aa = calc2(a, A);

  // print1(all(b));

  int bb = calc2(b, B);

  // print1(all(c));

  int cc = calc2(c, C);

  // dbg3(aa, bb, cc)

  // line()

  return aa + bb + cc;

}



int rec(int idx, vec<int> a, vec<int> b, vec<int> c) {

  if (idx >= N)  {

    if (a.size() == 0 || b.size() == 0 || c.size() == 0) return INF;

    int t = calc(a, b, c);

    // print1(all(a));

    // print1(all(b));

    // print1(all(c));

    // dbg(t)

    // line()

    return t;

  }



  int ret = INF;

  int i = idx;



  a.push_back(l[i]);

  chmin(ret, rec(idx + 1, a, b, c));

  a.pop_back();



  b.push_back(l[i]);

  chmin(ret, rec(idx + 1, a, b, c));

  b.pop_back();



  c.push_back(l[i]);

  chmin(ret, rec(idx + 1, a, b, c));

  c.pop_back();



  return ret;

}



signed main() {

  cin >> N >> A >> B >> C;

  l.resize(N);

  rep (i, N) {

    cin >> l[i];

  }



  vec<int> a;

  vec<int> b;

  vec<int> c;

  int ans = rec(0, a, b, c);

  cout << ans << endl;



  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.202995039027626x):
#include <bits/stdc++.h>

using namespace std;



#define int long long

#define all(v) (v).begin(), (v).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }



const int INF = 1e18;



int N, A, B, C;

vector<int> l;



// Aに使う竹の集合、Bに使う竹の集合、Cに使う竹の集合を渡すと、作りたい竹にするのにかかるコストを返してくれる

int calc(vector<int> &a, vector<int> &b, vector<int> &c) {

  int aRes = abs(accumulate(all(a), 0LL) - A) + ((a.size()-1) * 10);

  int bRes = abs(accumulate(all(b), 0LL) - B) + ((b.size()-1) * 10);

  int cRes = abs(accumulate(all(c), 0LL) - C) + ((c.size()-1) * 10);



  return aRes + bRes + cRes;

}



int rec(int idx, vector<int> &a, vector<int> &b, vector<int> &c) {

  if (idx >=  N) {

    if (a.size() == 0 or b.size() == 0 or c.size() == 0) return INF;

    return calc(a, b, c);

  }



  int ret = INF;



  // idx番目の竹をAに使う

  a.push_back(l[idx]);

  chmin(ret, rec(idx+1, a, b, c));

  a.pop_back();



  // idx番目の竹をBに使う

  b.push_back(l[idx]);

  chmin(ret, rec(idx+1, a, b, c));

  b.pop_back();



  // idx番目の竹をCに使う

  c.push_back(l[idx]);

  chmin(ret, rec(idx+1, a, b, c));

  c.pop_back();



  // idx番目の竹を使わない

  chmin(ret, rec(idx+1, a, b, c));



  return ret;

}



signed main() {

  cin >> N >> A >> B >> C;

  l.resize(N);

  for (int i = 0; i < N; i++) {

    cin >> l[i];

  }



  vector<int> a;

  vector<int> b;

  vector<int> c;

  cout << rec(0, a, b, c) << endl;



  return 0;

}