#include<bits/stdc++.h>
using namespace std;
int N,A,B,C,l[9],ans=1e9;
void rec(int i,int a,int b,int c,int mp){
  if(i==N){
    if(a&&b&&c)ans=min(ans,abs(A-a)+abs(B-b)+abs(C-c)+mp);
    return;
  }
  rec(i+1,a,b,c,mp);
  rec(i+1,a+l[i],b,c,mp+10*(a>0));
  rec(i+1,a,b+l[i],c,mp+10*(b>0));
  rec(i+1,a,b,c+l[i],mp+10*(c>0));
}
int main(){
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++)cin>>l[i];
  rec(0,0,0,0,0);
  cout<<ans<<endl;
}
