def int_raw():
    return int(raw_input())
 
def words_raw():
    return raw_input().split()
 
def ints_raw():
    return map(int, words_raw())

N, A, B, C = ints_raw()
l = [int_raw() for _ in range(N)]

INF = 1e10
def cost(idx, a, b, c):
	if idx == N:
		if min(a,b,c)  == 0:
			return INF
		else:
			return abs(a - A) + abs(b - B) + abs(c - C) - 30
	val1 = cost(idx + 1, a, b, c)
	val2 = cost(idx + 1, a + l[idx], b, c) + 10
	val3 = cost(idx + 1, a, b + l[idx], c) + 10
	val4 = cost(idx + 1, a, b, c + l[idx]) + 10
	return min(val1, val2, val3, val4)

print cost(0, 0, 0, 0)
