N, A, B, C = map(int, raw_input().split())
target = [A, B, C]
memo = [[[0, 0, 0], 0]]
for i in range(0, N):
	t = int(raw_input())
	m = len(memo)
	for j in range(0, m):
		now = memo[j]
		trees = now[0]
		mp = now[1]
		for k in range(0, 3):
			addmp = 0
			if trees[k] != 0: addmp = 10
			newmemo = [[trees[0], trees[1], trees[2]], mp+addmp]
			newmemo[0][k] += t
			memo.append(newmemo)
min = 1000000007
for i in range(0, len(memo)):
	if 0 not in memo[i][0]:
		sum = memo[i][1]
		for j in range(0, 3):
			sum += abs(target[j]-memo[i][0][j])
		if sum < min: min = sum
print min