import sys

#+++++


def aaa(ll,a,b,c):
	ret=a+b+c
	for i,v1 in enumerate(ll):
		t1=abs(a-v1)
		if ret < t1:
			continue
		for j,v2 in enumerate(ll):
			if i==j:
				continue
			t2=t1 + abs(b-v2)
			if ret < t2:
				continue
			for k,v3 in enumerate(ll):
				if i==k or j==k:
					continue
				t3 = t2 + abs(c-v3)
				ret=min(ret, t3)
	return ret		
		
def main():
	n , a, b, c = map(int, input().split())
	bb=[]
	for i in range(n):
		bb.append(int(input()))
	ans=a+b+c
	for i in range(4**n-1):
		la=[]
		lb=[]
		lc=[]
		l=[]
		for j in range(n):
			sd=(i%(4 ** (j+1)))//(4**j)
			kk=bb[j]
			pp=0
			if sd == 0:
				la.append(kk)
			elif sd==1:
				lb.append(kk)
			elif sd==2:
				lc.append(kk)
			else:
				l.append(kk)
		pp=max(0,len(la)-1)+max(len(lb)-1,0)+max(0,len(lc)-1)
		l=l+[sum(la),sum(lb),sum(lc)]
		#print(l)
		ans=min(ans,aaa(l,a,b,c)+pp*10)
				
	
	print(ans)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)