#include<bits/stdc++.h>
using namespace std;
int N,A,B,C;
vector<int> vec;
int dfs(int cur,int a,int b,int c){
  if(cur==N){
    return min({a,b,c})>0? abs(a-A)+abs(b-B)+abs(c-C)-30:1e9;
  }
  int ret0=dfs(cur+1,a,b,c);
  int ret1=dfs(cur+1,a+vec[cur],b,c)+10;
  int ret2=dfs(cur+1,a,b+vec[cur],c)+10;
  int ret3=dfs(cur+1,a,b,c+vec[cur])+10;
  return min({ret0,ret1,ret2,ret3});
}

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