#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int N,A,B,C;
int l[8];
int ans = 100000000;
void dfs(int depth,int a,int b,int c,int cost){
    if(depth == N){
        if(a != 0 && b != 0 && c != 0)
            ans = min(ans,cost + (abs(A-a) + abs(B-b) + abs(C-c) - 30));
    return ;
    }
    dfs(depth+1,a+l[depth],b,c,cost+10);
    dfs(depth+1,a,b+l[depth],c,cost+10);
    dfs(depth+1,a,b,c+l[depth],cost+10);
    dfs(depth+1,a,b,c,cost);
}
int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++) cin >> l[i];
    dfs(0,0,0,0,0);
    cout << ans << "\n";
    return 0;
}

