N, A, B, C = list(map(int, raw_input().split()))
length = list()
for n in xrange(N): length.append(int(raw_input()))

INF = 10 ** 16

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

print cost(0, 0, 0, 0)
 