import copy

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

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

ans = 10**20

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