# -*- coding: utf-8 -*-
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()

P=[]
for i in itertools.product(range(4), repeat=N):	#a:0 , b:1 , c:2 , unused:3
	P.append(i)				#Permutation


ans=float("inf")

for u in P:
	t=0	#答えの候補
	a=0; b=0; c=0	#3本の竹の長さの候補
	for i,x in enumerate(u):
		if x==0: a+=L[i]
		elif x==1: b+=L[i]
		elif x==2: c+=L[i]

	if a!=0 and b!=0 and c!=0:	#候補の数が３つできることは必須
		T=[a,b,c]
		T.sort(reverse=True)
		for x, y in zip(ORG, T):
			t+=abs(x-y)

		CT=Counter(u)
		for num, cnt in CT.items():
			if num in (0,1,2):
				t+=(cnt-1)*10
		ans=min(ans, t)


print ans
