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


def dfs(n, a, b, c):
    if n == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else 10 ** 9
    ret0 = dfs(n + 1, a, b, c)
    ret1 = dfs(n + 1, a + take[n], b, c) + 10
    ret2 = dfs(n + 1, a, b + take[n], c) + 10
    ret3 = dfs(n + 1, a, b, c + take[n]) + 10
    return min(ret0, ret1, ret2, ret3)


print(dfs(0, 0, 0, 0))
