import sys,collections,math,itertools,copy;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n, a, b, c = Is()
lis = []
ps = list(itertools.permutations([c,b,a]))
ans = []
for i in range(n):
    lis.append(I())

for p in ps:
    clis = copy.deepcopy(lis)
    tan = 0
    for ep in p:
        min_s = 10**10
        com = 0
        for i in range(1,len(clis)+1):
            t = list(itertools.combinations(clis,i))
            for e in t:
                s = (len(e)-1)*10 + abs(sum(e) - ep)
                if s < min_s:
                    min_s = s
                    com = e
        for e in com:
            clis.remove(e)
        tan += min_s
    ans.append(tan)
print(min(ans))
    