// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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));

  // No

  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;

}

// Fastest known solution for this problem: