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

from itertools import combinations, permutations
ans = float('inf')
for i in range(3, N+1):
    for c in combinations(l,i):
        for l1,l2,*li in permutations(c):
            l3 = sum(li)
            for a,b,c in permutations([A,B,C]):
                cost = (len(li)-1)*10
                cost += abs(l1-a) + abs(l2-b) + abs(l3-c)
                ans = min(ans, cost)
print(ans)