N, A, B, C = map(int, input().split())
inputs = [int(input()) for _ in range(N)]

def dfs(depth, a, b, c):
	if depth == N:
		if a == 0 or b == 0 or c == 0:
			return 1e9
		return abs(A - a) + abs(B - b) + abs(C - c)
	
	ans = dfs(depth+1, a, b, c)
	ans = min(ans, dfs(depth + 1, a + inputs[depth], b, c)) + 10 * (a != 0)
	ans = min(ans, dfs(depth + 1, a, b + inputs[depth], c)) + 10 * (b != 0)
	ans = min(ans, dfs(depth + 1, a, b, c + inputs[depth])) + 10 * (c != 0)
	
	return ans

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