#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,ans;
int L[10],visited[10];
int dfs(int k, int a, int b, int c){
    if(k == n){
        if(a == 0 || b == 0 || c == 0) return MAX;
        return abs(a - A)+abs(b-B)+abs(c-C);
    }
    int ans = MAX;
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c>0 ? 10:0));
    ans = main(ans, dfs(k+1,a,b,c));
    return ans;
}
int main(){
    cin >> n >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    cout << dfs(0,0,0,0) << endl;
    return 0;
}


