import itertools

def main():
    N, A, B, C = list(map(int, input().split()))
    bars = [A,B,C]
    l = []
    for i in range(N):
        l.append(int(input()))
        if l[-1] in bars:
            j = bars.index(l[-1])
            del bars[j]
            del l[-1]

    # print(bars, l)
    ret = 0

    for k in range(len(bars)):
        full = []
        for i in range(1, N-len(bars[k:])+1):
            full += list(itertools.combinations(l, i))
        # print(full)


        mini = 1000000000
        arg_min = []
        for i in full:
            if abs(sum(i)-bars[k]) < mini:
                mini = abs(sum(i)-bars[k])
                arg_min = i
        
        # print(mini, arg_min)
        ret += 10*(len(arg_min)-1) if len(arg_min)!=0 else 0
        ret += mini
        for i in arg_min:
            del l[l.index(i)]
    print(ret) 

if __name__ == "__main__":
    main()