#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int n,A,B,C,l[15];

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


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