#include<bits/stdc++.h>
using namespace std;
int N,A,B,C;
const int INF=1e9;

vector<int>l;

int dfs(int a,int b,int c,int d){
 if(d==N){
    if(min(a,min(b,c))==0) return INF;
    else return abs(a-A) + abs(b-B) + abs(c-C) - 30;
  }
  
  int MP1=dfs(a,b,c,d+1);
  int MP2=dfs(a+l[d],b,c,d+1)+10;
  int MP3=dfs(a,b+l[d],c,d+1)+10;
  int MP4=dfs(a,b,c+l[d],d+1)+10;
  
  return min(min(MP1,MP2),min(MP3,MP4));
}

  
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;

}