def main():
    minmp = 10000000
    def dfs(depth, pt):

        if depth==n:
            mp_tmp = 0
            all_used = True
            for k in range(3):
                if pt.count(k) == 0:
                    all_used = False
                    break

                sum_tmp = 0
                mp_tmp += (pt.count(k) - 1)*10
                for l in range(n):
                    if pt[l] == k:
                        sum_tmp += moto[l]
                
                mp_tmp += abs(sum_tmp-take[k])

            if all_used == True:
                global minmp
                minmp = min(minmp,mp_tmp)
                return
            else:
                return

        for i in range(4):
            pt[depth] = i
            dfs(depth+1, pt)

        return

    #入力をとる
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]


    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    pt  = [3]*n
    for i in range(n):
        dfs(i,pt)

    print(minmp)

main()