#include<bits\stdc++.h>
#include<math.h>
using namespace std ;
int N,A,B,C,arr[100];
int ret_cost(int n,int a,int b,int c)
{
    if(n==N)
    {
        return  (abs(A-a)+abs(B-b)+abs(C-c)) ;
    }
    int ret = (a>0 ? 10:0) + ret_cost(n+1,a+arr[n],b,c);
    ret = min ( ret ,(b>0 ? 10:0) + ret_cost(n+1,a,b+arr[n],c));
    ret = min (ret ,(c>0 ? 10:0) + ret_cost(n+1,a,b,c+arr[n]));
    ret = min(ret,ret_cost(n+1,a,b,c));
}
int main()
{
    cin >> N >> A >> B >> C ;
    for(int i=0;i<N;i++)
    {
        int x ; cin >> x ; arr[i]=x ;
    }
     cout << ret_cost(0,0,0,0) << endl;;
}
