import itertools

def powerset(seq, m):
	return [ list(u) for u in itertools.product(*([seq]*m) ) ]

def cnt(seq,v):
	return len([x for x in seq if x==v])

def main():
	N,a,b,c = map(int, raw_input().split())
	ls = [input() for _ in range(N)]
	res = 10**9
	for vs in powerset([0,1,2,3], N):
		aa = []
		bb = []
		cc = []
		for i in range(N):
			if vs[i]==0:aa.append(ls[i])
			elif vs[i]==1:bb.append(ls[i])
			elif vs[i]==2:cc.append(ls[i])
			else:
				assert vs[i]==3
		if len(aa)==0 or len(bb)==0 or len(cc)==0:continue
		res=min(res, abs(a-sum(aa))+abs(b-sum(bb))+abs(c-sum(cc))+10*(len(aa)-1 + len(bb)-1 + len(cc)-1)  )
	print res
	
	return 0

if __name__ == '__main__':
	main()

