#include <bits/stdc++.h>
using namespace std;
int N,A,B,C;
vector<int> l;
const int INF = 1e9;

int dfs(int num, int a, int b, int c){
  if(num==N){
    if(min(a,min(b,c))==0) return INF;
    else return abs(a-A) + abs(b-B) + abs(c-C) - 30;
  }

  int MP1 = dfs(num+1, a, b, c);
  int MP2 = dfs(num+1, a+l[num], b, c) + 10;
  int MP3 = dfs(num+1, a, b+l[num], c) + 10;
  int MP4 = dfs(num+1, a, b, c+l[num]) + 10;

  return min(min(MP1,MP2),min(MP3,MP4));
}

int main(){
  cin >>N >>A >>B >>C;
  l.resize(N);
  for(int i=0;i<N;i++){
    int x; cin >>x;
    l[i] = x;
  }

  cout << dfs(0,0,0,0) << endl;
  return 0;
}