n,A,B,C=map(int,input().split())
L=[]
r=10000
for i in range(n):
	l=int(input())
	L.append(l)
def k(i,a,b,c,s):
	global r
	if i==n:
		if a!=A and b!=B and c!=C:
			s+=abs(a)+abs(b)+abs(c)-30
			r=min(r,s)
	else:
		k(i+1,a-L[i],b,c,s+10)
		k(i+1,a,b-L[i],c,s+10)
		k(i+1,a,b,c-L[i],s+10)
		k(i+1,a,b,c,s)
a=A
b=B
c=C
k(0,a,b,c,0)
print(r)