#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll l[9];
ll n,A,B,C;

int dfs(ll a,ll b,ll c,ll d){
  if(d == n){
    if(a==0 || b==0 || c==0){
      return 1000000000;
    }
    else{
      return abs(A-a)+abs(B-b)+abs(C-c)-30;
    }
  }
  ll MP1 = dfs(a,b,c,d+1);
  ll MP2 = dfs(a+l[d],b,c,d+1)+10;
  ll MP3 = dfs(a,b+l[d],c,d+1)+10;
  ll MP4 = dfs(a,b,c+l[d],d+1)+10;
  return min(min(MP1,MP2),min(MP3,MP4));
}

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