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

def f(n, a, b, c):
    if n == N:
        if a == 0 or b == 0 or c == 0:
            return 1000000
        else:
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
    x = f(n + 1, a, b, c)
    y = f(n + 1, a + l[n], b, c) + 10
    z = f(n + 1, a, b + l[n], c) + 10
    w = f(n + 1, a, b, c + l[n]) +10
    return min(x, y, z, w)

print(f(0, 0, 0, 0))
