N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
INF = 10**9+7

def dfs(count,a,b,c):
	if count == N:
		if min(a,b,c) > 0:
			return abs(a-A)+abs(b-B)+abs(c-C)-30
		else:
			return INF
	non = dfs(count+1,a,b,c)
	useA = dfs(count+1,a+l[count],b,c)+10
	useB = dfs(count+1,a,b+l[count],c)+10
	useC = dfs(count+1,a,b,c+l[count])+10
	return min(non,useA,useB,useC)

print(dfs(0,0,0,0))