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

int N,A,B,C;

int dfs(int cur, int a, int b, int c,vector<int> l){
  int ret0,ret1,ret2,ret3;
  if(cur == N) return min(a,min(b,c)) > 0 ? abs(a-A) +  abs(b-B) + abs(c-C) - 30 : 1e9;
  ret0 = dfs(cur+1,a,b,c,l);
  ret1 = dfs(cur+1,a+l[cur],b,c,l) + 10;
  ret2 = dfs(cur+1,a,b+l[cur],c,l) + 10;
  ret3 = dfs(cur+1,a,b,c+l[cur],l) + 10;
  return min(min(ret0,ret1),min(ret2,ret3));
}

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