import itertools

def rotate(l, n):
    return l[-n:] + l[:-n]

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()))

    all_min = 10000000000

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

            mini = 1000000000
            arg_min = []
            for i in full:
                if abs(sum(i)-bars[k]) + 10*max(len(i)-1, 0) < mini:
                    mini = abs(sum(i)-bars[k]) + 10*max(len(i)-1, 0)
                    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)]

        all_min = min(all_min, ret)
    print(all_min) 

if __name__ == "__main__":
    main()