n, a, b, c = map(int, input().split())

res = float('inf')
    
l = [int(input()) for _ in range(n)]
for i in range(1, 4 ** n):
    j, x = 0, [a, b, c]
    ans = 0
    while i:
        k = i % 4
        if k: 
            x[k - 1] -= l[j]
            ans += 10
        j += 1
        i //= 4
    ans += sum(map(abs, x))
    res = min(res, ans)
print(res)