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


def f(a, b, c, n):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else 10 ** 9
    ans = f(a, b, c, n + 1)
    ans = min(ans, f(a + l[n], b, c, n + 1) + 10)
    ans = min(ans, f(a, b + l[n], c, n + 1) + 10)
    ans = min(ans, f(a, b, c + l[n], n + 1) + 10)
    return ans


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