import copy

N, A, B, C = list(map(int, input().split()))
ls = [int(input()) for i in range(N)]

nums = [[0, 0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 0]] 
    
for l in ls:
    tmpA = []
    for num in nums:
        for i in range(3):
            tmpB = copy.deepcopy(num)
            if tmpB[i]:
                tmpB[3] += 10
            tmpB[i] += l            
            tmpA.append(tmpB)
    nums.extend(tmpA)   

ans = 10**20

for num in nums:
    n = abs(A-num[0]) + abs(B-num[1]) + abs(C-num[2]) + num[3]
    ans = min(ans, n)
print(ans)
