#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


int const static N = 10;
int l[N];
int n;

// return sunsumed MP.
int dp(int now_rest , int mp, bool first){

  //cout << "FIRST ===="<<endl;
  //cout << "rest:"<<now_rest<<",mp:"<<mp<<endl;
  if( !first && now_rest == 0){
    return mp;
  }

  if ( !first && abs(now_rest) <= 10 ){
    return mp + abs(now_rest);
  }

  int sel = 0;
  int new_rest = abs(now_rest - l[sel]);
  rep(i,n){
    if( new_rest > abs(now_rest - l[i]) ) {
      sel = i;
      new_rest = abs(now_rest - l[i]);
    }
  }
  l[sel] = 0;

  if(new_rest == now_rest){
    return mp + abs(now_rest);
  }
  //cout << "new_rest:" << new_rest << endl;
  //cout << "END ===" << endl;
  if( first ) {
    return dp(new_rest, mp, false);
  }else {
    return dp(new_rest, mp+10, false);
  }
  
}

int main(){
  cin>>n;
  int a;cin>>a;
  int b;cin>>b;
  int c;cin>>c;
  rep(i,n) cin>>l[i];


  sort(l, l+n);

  int mp = 0;
  
  mp += dp(a,0, true);
  //cout << "mp:" <<mp << endl;
  mp += dp(b,0, true);
  //cout << "mp:" <<mp << endl;
  mp += dp(c,0, true);

  //cout << "mp:" <<mp << endl;
  cout << <<mp << endl;
}