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

int N, A, B, C;
vector<int> l(8);

int dfs(int n, int a, int b, int c){
  if(n == N){
    if(a==0 || b==0 || c==0){
      return 999999;
    }
    return abs(A-a) + abs(B-b) + abs(C-c) - 30;
  }else{
    int nouse = dfs(n+1, a, b, c);
    int useForA = dfs(n+1, a+l.at(n), b, c) + 10;
    int useForB = dfs(n+1, a, b+l.at(n), c) + 10;
    int useForC = dfs(n+1, a, b, c+l.at(n)) + 10;
    return min({nouse, useForA, useForB, useForC});
  }
}

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