// Slower C++ solution:
#include<iostream>

#include <cmath>

using namespace std;

using ll = long long;

int main(){

    ll N,A,B,C;

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

    int l[8] = {};

    for(int i = 0; i < N; i++) cin >> l[i];

    int d[8];

    ll ans = 10000000000;

    

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

        d[0] = i;

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

            d[1] = j;

            for(int k = 0; k < 4; k++){

                d[2] = k;

                for(int m = 0; m < 4; m++){

                    d[3] = m;

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

                        d[4] = n;

                        for(int o = 0; o < 4; o++){

                            d[5] = o;

                            for(int p = 0; p < 4; p++){

                                d[6] = p;

                                for(int q = 0; q < 4; q++){

                                    d[7] = q;

                                    ll a = 0,b = 0,c = 0,interim = 0;

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

                                        if(d[z] == 0){

                                            a += l[z];

                                            interim += 10;

                                        }

                                        else if(d[z] == 1){

                                            b += l[z];

                                            interim += 10;

                                        }

                                        else if(d[z] == 2){

                                            c += l[z];

                                            interim += 10;

                                        }

                                    }

                                    if(a == 0 || b == 0 || c == 0) continue;

                                    interim += (abs(A-a) + abs(B-b) + abs(C-c) - 30);

                                    if(ans > interim) ans = interim;

                                }

                            }

                        }

                    }

                }

            }

        }

    }

    cout << ans << "\n";

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.2465357892821767x):
#include <iostream>

#include <fstream>

#include <set>

#include <map>

#include <string>

#include <vector>

#include <queue>

#include <deque>

#include <stack>

#include <functional>

#include <algorithm>

#include <climits>

#include <cmath>

#include <iomanip>

using namespace std;

#define ll long long int

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

#define rrep(i,n) for( int i = n; i >= 0; i-- )

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000





int main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int N, A[3];

    cin >> N >> A[0] >> A[1] >> A[2];

    int l[8];

    rep(i, N) cin >> l[i];

    int ans = INF;

    int pattern = (1 << (N * 2));

    rep(k, pattern) {

        int cnt[3] = {};

        int bit = k;

        int sum[3] = {};

        rep(i, N) {

            int c = bit % 4;

            bit /= 4;

            if(c == 3) continue;

            cnt[c]++;

            sum[c] += l[i];

            

        }

        bool ok = true;

        int tmp = 0;

        rep(i, 3) {

            if(cnt[i] == 0) ok = false;

            tmp += (cnt[i] - 1) * 10;

            tmp += abs(A[i] - sum[i]);

        }

        if(!ok) continue;

        ans = min(ans, tmp);

    }

    cout << ans << endl;



    return 0;

}