#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[N];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a, min(b, c)) > 0){
            return abs(a - A)+abs(b - B)+abs(c - C);
        } else {
            return MAX;
        }
    }
    ans = min(ans, dfs(k+1, a, b, c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + 10);
    ans = min(ans, dfs(k+1, a, b+L[k], c) + 10);
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + 10);
    return ans;
}
int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    int res = dfs(0,0,0,0);
    cout << res << endl;
}

