#include "bits/stdc++.h"

using namespace std;

//void chimin(int &a,int b){
  //  if(a>b)a=b;
//}

int n,A,B,C;
vector<int >l;

int dfs(int i,int a, int b,int c){
    if(i==n){
        if(!a||!b||!c)return 100000;
        return abs(a-A)+abs(b-B)+abs(c-C);
    }
    int res =dfs(i+1,a,b,c);
    res=min(res,dfs(i+1,a+l[i],b,c)+(a?10:0));
    res=min(res,dfs(i+1,a,b+l[i],c)+(b?10:0));
    res=min(res,dfs(i+1,a,b,c+l[i])+(c?10:0));
    return res;
}

int main()
{
    cin >> n >> A >> B >> C;
    l.resize(n);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    cout << dfs(0,0,0,0)<< endl;
    return 0;
}
