def base4(x):
    if int(x/4):
        return base4(int(x/4)) + str(x%4)
    return str(x%4)

N,A,B,C = list(map(int,input().split()))
l = []
for n in range(N):
    l.append(int(input()))

res = 99999999
for i in range(4**N):
    c = [[0,0,0],[-1,-1,-1]]
    for j,b in enumerate(base4(i)):
        if b == '1':
            c[0][0] += l[j]
            c[1][0] += 1
        elif b == '2':
            c[0][1] += l[j]
            c[1][1] += 1
        elif b == '3':
            c[0][2] += l[j]
            c[1][2] += 1
    if c[1][0] >= 0 and c[1][1] >= 0 and c[1][2] >= 0:
        res = min(res,abs(c[0][0]-A)+abs(c[0][1]-B)+abs(c[0][2]-C)+sum(c[1])*10)

print(res)