import itertools

def calc(p, c, t):
    aa = p[:c[0]+1]
    bb = p[c[0]+1:c[1]+1]
    cc = p[c[1]+1:c[2]+1]
    res1 = abs(sum(aa) - t[0]) + abs(sum(bb) - t[1]) + abs(sum(cc) - t[2])
    res2 = (len(aa) + len(bb) + len(cc) - 3) * 10
    return res1 + res2

if __name__ == "__main__":
    n, a, b, c = [int(i) for i in input().split(" ")]
    l = []
    for i in range(n):
        l.append(int(input()))
    perms = itertools.permutations(l)
    combs = itertools.combinations(range(n), 3)
    ans = 1<<30
    for p in itertools.permutations(l):
        for co in itertools.combinations(range(n), 3):
            ans = min(ans, calc(p, co, [a,b,c]))
    print(ans)
