#include <bits/stdc++.h>
using namespace std;

const int MAX=10000;
int n,A,B,C;
int l[MAX];

int dfs(int cur,int a,int b,int c){
  if(cur==n){
    if(a==0 || b==0 || c==0){
      return 1000000000;
    }else{
      return abs(a-A)+abs(b-B)+abs(c-C)-30;
    }
  }
  int r=dfs(cur+1,a,b,c);
  int r2=dfs(cur+1,a+l[cur],b,c)+10;
  int r3=dfs(cur+1,a,b+l[cur],c)+10;
  int r4=dfs(cur+1,a,b,c+l[cur])+10;
  return min(min(r,r2),min(r3,r4));
}

int main(){
  cin>>n;
  cin>>A>>B>>C;
  for(int i=0;i<n;i++){
    cin>>l[i];
  }
  cout<<dfs(0,0,0,0)<<endl;
}