import itertools
from collections import Counter

N,A,B,C=map(int,raw_input().split())
ORG=[A,B,C]
ORG.sort(reverse=True)

L=[ input() for i in range(N) ]
L.sort()

C=[]
for i in itertools.product(range(8), repeat=N):
	C.append(i)


#C=[ (1, 0, 1, 1, 0), (2,2,2, 1,0) ]


ans=float("inf")
for x in C:
	a=0; b=0 ;c=0
	ans_kouho=0

	count=Counter(x) 
	len_x=len( count)

	if len_x!=3:
		continue

	for j in count.values():
		ans_kouho+=(j-1)*10



	for idx, i in enumerate(x):
		if i==0: 	a+=L[idx]
		elif i==1: b+=L[idx]
		elif i==2: c+=L[idx]
		T=[a,b,c]
	T.sort(reverse=True)
		
	for x, y in zip(ORG,T):
		ans_kouho+=abs(x-y)
	ans=min(ans, ans_kouho)


print ans

