#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,k;
int mmp=10000;
vector<int> l;
int rec(int pi,int la,int lb,int lc,int pmp){
 if(pi==n){
   if(la&&lb&&lc){
   mmp=min(mmp,pmp+abs(la-a)+abs(lb-b)+abs(lc-c));return mmp;}else{
     return mmp;
   }
 }
 rec(pi+1,la,lb,lc,pmp);
 rec(pi+1,la+l[pi],lb,lc,pmp+(la?10:0));
 rec(pi+1,la,lb+l[pi],lc,pmp+(lb?10:0));
 rec(pi+1,la,lb,lc+l[pi],pmp+(lc?10:0));
 return mmp;
}
int main(){
cin>>n>>a>>b>>c;
for(int i=0;i<n;i++){
  cin>>k;
l.push_back(k);
}
  cout<<rec(0,0,0,0,0)<<endl;

}