#include <iostream>
#include <vector>

using namespace std;

int N, A, B, C;
vector<int> v;

int dfs(int k, int a, int b, int c){
  if(k==N){
    return abs(a-A)+abs(b-B)+abs(c-C)+1e6*(a==0||b==0||c==0);
  }
  int c1 = dfs(k+1, a, b, c);
  int c2 = dfs(k+1, a+v[k], b, c)+(a==0?0:10);
  int c3 = dfs(k+1, a, b+v[k], c)+(b==0?0:10);
  int c4 = dfs(k+1, a, b, c+v[k])+(c==0?0:10);
  return min(c1,min(c2,min(c3,c4)));
}

int main(){
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){
    int l; cin>>l; v.push_back(l);
  }
  int ans = dfs(0,0,0,0);
  cout<<ans<<endl;
}
