#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
    ll N,A,B,C;
    vector<int> L;
 
int rec(int i, int a, int b, int c){
  if(i == N) {
    if(!a || !b || !c) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  
  int res = rec(i+1, a, b, c);
  
  chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
  chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
  chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));
  
  return res;
}
 
int main(){
    cin >> N >> A >> B >> C;
  	L.resize(N);
  	for(int i = 0; i < N; ++i) cin >> L[i];
    cout << rec(0, 0, 0, 0) << endl;
}