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

def dfs(res, a, b, c):
	if res == N:
		if a != 0 and b != 0 and c != 0:
			return abs(a-A) + abs(b-B) + abs(c-C) -30
		else:
			return INF
	else:
		ret0 = dfs(res+1,a,b,c)
		ret1 = dfs(res+1,a+l[res],b,c) + 10
		ret2 = dfs(res+1,a,b+l[res],c) + 10
		ret3 = dfs(res+1,a,b,c+l[res]) + 10
		return min(ret0,ret1,ret2,ret3)

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