#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
int N,A,B,C,l[10];

int dfs(int n,int la,int lb,int lc){
    if(n==N-1 && la>0 && lb>0 && lc>0) {return abs(A-la)+abs(B-lb)+abs(C-lc)-30;}
    if(n==N-1) return 999999999;
    int pos1 = dfs(n+1,la+l[n],lb,lc)+10;
    int pos2 = dfs(n+1,la,lb+l[n],lc)+10;
    int pos3 = dfs(n+1,la,lb,lc+l[n])+10;
    int pos4 = dfs(n+1,la,lb,lc);
    return min({pos1,pos2,pos3,pos4});
}

main() {
    cin >> N >> A >> B >> C;
    int l[N]; rep(i,N) cin >> l[i];
    cout << dfs(0,0,0,0) << endl;
}