#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=100010;
int A,B,n,C,l[10];
int solve(int idx,int a,int b,int c)
{
  if(idx==n)
  {
    if(!a || !b || !c) return 80000;
    return abs(a-A)+abs(b-B)+abs(c-C);
  }
  int res=solve(idx+1,a,b,c);
  res=min(res,solve(idx+1,a+l[idx],b,c)+(a?10:0));
  res=min(res,solve(idx+1,a,b+l[idx],c)+(b?10:0));
  res=min(res,solve(idx+1,a,b,c+l[idx])+(c?10:0));
  return res;
}
int main()
{
  cin>>n>>A>>B>>C;
  for(int i=0;i<n;i++) cin>>l[i];
  cout<<solve(0,0,0,0)<<endl;
  return 0;
}
