// 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(vec<int> v, int val) {

  int ret = INF;

  int n = v.size();



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

    int cnt = 0;

    int sum = 0;

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

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

        sum += v[i];

        cnt++;

      }

    }

    if (cnt == 0) continue;

    chmin(ret, (cnt-1)*10 + abs(sum - val));

  }



  return ret;

}



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

  return calc2(a, A) + calc2(b, B) + calc2(c, C);

}



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;

    return calc(a, b, c);

  }



  int ret = INF;



  a.push_back(l[idx]);

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

  a.pop_back();



  b.push_back(l[idx]);

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

  b.pop_back();



  c.push_back(l[idx]);

  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: 2.072147452869463x):
#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;

}