#include <bits/stdc++.h>
using namespace std;
long long arr[9],n,A,B,C;
long long dfs(long long l,long long a,long long b,long long c)
{
	long long r1,r2,r3,r4;
    if(l==n)
	    if(a==0||b==0||c==0)
		    return 10000;
        else
            return abs(a-A)+abs(b-B)+abs(c-C);
	r1=dfs(l+1,a+arr[l+1],b,c)+10;
	r2=dfs(l+1,a,b+arr[l+1],c)+10;
	r3=dfs(l+1,a,b,c+arr[l+1])+10;
	r4=dfs(l+1,a,b,c);
	return min(min(r1,r2),min(r3,r4));
}
int main()
{
	long long i;
    scanf("%lld %lld %lld %lld",&n,&A,&B,&C);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&arr[i]);   
    }
    printf("%lld",dfs(0,0,0,0)-30);
    return 0;
}