#include<bits/stdc++.h>
using namespace std;
#define   int      long long
#define   fast()   ios_base::sync_with_stdio(0);cin.tie(0)
int INF=1e9;
int N,A,B,C;
vector<int> v;
int dfs(int cur,int a,int b,int c)
{if(cur==N)
 {if(min({a,b,c})>0)
  return abs(A-a)+abs(B-b)+abs(C-c)-30;
  return INF;
 }
 int w=dfs(cur+1,a,b,c);
 int x=dfs(cur+1,a+v[cur],b,c)+10;
 int y=dfs(cur+1,a,b+v[cur],c)+10;
 int z=dfs(cur+1,a,b,c+v[cur])+10;
 return min({w,x,y,z});
}
int32_t main()
{int i;
 fast();
 cin>>N>>A>>B>>C;
 v=vector<int>(N);
 for(i=0;i<N;++i)
 cin>>v[i];
 cout<<dfs(0,0,0,0);
 return 0;
}



