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

def bamboo(i, a, b, c):
    if i == N:
        return abs(A - a) + abs(B - b) + abs(C - c)
    ans = bamboo(i + 1, a, b, c)
    ans = min(ans, bamboo(i + 1, a + l[i], b, c) + (10 if a else 0))
    ans = min(ans, bamboo(i + 1, a, b + l[i], c) + (10 if b else 0))
    ans = min(ans, bamboo(i + 1, a, b, c + l[i]) + (10 if c else 0))
    return ans

print(bamboo(0, 0, 0, 0))