from itertools import product

N,*T = map(int,input().split())
L = [int(input()) for i in range(N)]
ans = 3000

for x in product([0,1,2,3], repeat=N):
    cost = 0
    l = [0]*4
    for i,v in enumerate(x):
        l[v] += L[i]
        if v<3:
            cost += 10

    if 0 in l[:3]:
        continue
    cost -= 30
    for i in range(3):
        cost += abs(l[i]-T[i])
    ans = min(ans, cost)

print(ans)
