#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int, C: int, l: "List[int]"):
    result = 10000000000
    for i in range(2**(N*2) -1):
        bitBase = i | 2**(N*2)
        debug = False
        # if i == 4626:
        #     debug = True
        mergeCost = 0
        a = 0
        b = 0
        c = 0
        debugStr = ""
        for j in range(N):
            flag = ((3 << (j * 2)) & bitBase) >> (j * 2)
            if flag == 1:
                if a != 0:
                    mergeCost+= 10
                if debug:
                    debugStr += "A"
                a += l[j]
            elif flag == 2:
                if b != 0:
                    mergeCost += 10
                if debug:
                    debugStr += "B"
                b += l[j]
            elif flag == 3:
                if c != 0:
                    mergeCost += 10 
                if debug:
                    debugStr += "C"               
                c+= l[j]
            else:
                if debug:
                    debugStr += "X"
        cost = mergeCost + abs(A-a) + abs(B - b) + abs(C - c)
        if debug:
            print(debugStr)
        # if cost == 120:
        #     print(i)
        result = min(cost,result)
    print(result)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    l = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, B, C, l)

if __name__ == '__main__':
    main()
