def dfs(i, A, B, C):
    global ans
    if i == n:
        if A and B and C:
            s = 0
            ABC = [A, B, C]
            for i in range(3):
                s += (len(ABC[i]) - 1) * 10 + abs(sum(ABC[i]) - abc[i])
            if s == 110:
                print(A, B, C)
            ans = min(ans, s)
    else:
        dfs(i + 1, A + [l[i]], B, C)
        dfs(i + 1, A, B + [l[i]], C)
        dfs(i + 1, A, B, C + [l[i]])
        dfs(i + 1, A, B, C)

n, a, b, c = map(int, input().split())
l = [int(input()) for i in range(n)]
abc = [a, b, c]
ans = float("inf")
dfs(0, [], [], [])
print(ans)