#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll dfs(ll i,ll ap,ll bp,ll cp,ll n,ll a,ll b,ll c,vector<ll> l){
    if(i==n){
        if(min({ap,bp,cp})>0) return fabs(a-ap)+fabs(b-bp)+fabs(c-cp)-30;
        else return 1e9;
    }
    ll usea=dfs(i+1,ap+l[i],bp,cp,n,a,b,c,l)+10;
    ll useb=dfs(i+1,ap,bp+l[i],cp,n,a,b,c,l)+10;
    ll usec=dfs(i+1,ap,bp,cp+l[i],n,a,b,c,l)+10;
    ll use_=dfs(i+1,ap,bp,cp,n,a,b,c,l);
    return min({usea,useb,usec,use_})
}

int main(){
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    vector<ll> l(n);
    for(ll i=0;i<n;i++) cin>>l[i];
    cout<<dfs(0,0,0,0,n,a,b,c)<<endl;
    return 0;
}