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

using namespace std;



#define int long long

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;



// 「使用する可能性のある竹の集合」と「目標の長さ」を渡すと、目標の長さにするための最小コストを返してくれる

int calc2(vector<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;

}



// Aに使う竹、Bに使う竹、Cに使う竹の集合を渡すと、それぞれの目標の高さにするまでの最小コストを返してくれる

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

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

}



// 「Aに使う可能性のある竹の集合」「Bに使う可能性のある竹の集合」「Bに使う可能性のある竹の集合」を全列挙

int rec(int idx, vector<int> a, vector<int> b, vector<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;



  // 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();



  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;

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



  cout << ans << endl;



  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.856195482176147x):
#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 rec(int idx, int a, int b, int c) {

  if (idx >= N) {

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

    return abs(a - A) + abs(b - B) + abs(c - C);

  }



  int ret = INF;



  // A

  chmin(ret, rec(idx+1, a+l[idx], b, c) + (a > 0 ? 10 : 0));

  // B

  chmin(ret, rec(idx+1, a, b+l[idx], c) + (b > 0 ? 10 : 0));

  // C

  chmin(ret, rec(idx+1, a, b, c+l[idx]) + (c > 0 ? 10 : 0));

  // なし

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



  return ret;

}



signed main() {

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

  l.resize(N);

  rep (i, N) {

    cin >> l[i];

  }



  cout << rec(0, 0, 0, 0) << endl;



  return 0;

}