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

b = []
for x in range(4**N):
    o = []
    s = -30
    for y in range(N):
        o.append((x//(4**y))%4)
    if (0 in o) and (1 in o) and (2 in o):
        a = [A,B,C]
        for y in range(N):
            if o[y] != 3:
                a[o[y]] -= l[y]
                s += 10
        b.append(sum(map(lambda x: x if x > 0 else -x,a))+s)

print(min(b))


