#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int N,M,K,A,B,C,ans=0,cnt=0,ret_0,ret_1,ret_2,ret_3;
string S,T;
vector<int> P,Q;
vector<pair<int,int>> PP;
bool CAN=false;



int dfs(int n,int a,int b,int c){ //n本目まででa,b,cを作るのに必要なコスト
  if(n==0) return A+B+C;
  ret_0=dfs(n-1,a,b,c);
  ret_1=dfs(n-1,a-P.at(i),b,c)+10;
  ret_2=dfs(n-1,a,b-P.at(i),c)+10;
  ret_3=dfs(n-1,a,b,c-P.at(i))+10;
  return min(ret_0,min(ret_1,min(ret_2,ret_3)))+abs(a-A)+abs(b-B)+abs(c-C);
}


int main(){
  cin>>N>>A>>B>>C;
  P.push_back(0);
  REP(i,N){
    int h;
    cin>>h;
    P.push_back(h);
  }
  
  dfs(N,A,B,C);
}