from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,A,B,C = inpl()
ppp = [A,B,C]
ba = [inp() for _ in range(n)]
res = INF
for pt in itertools.product(range(4), repeat=n):
    # print(pt)
    xxx = [0] * 3
    cnt = [0] * 3
    for i,x in enumerate(pt):
        if x == 0: continue
        xxx[x-1] += ba[i]
        cnt[x-1] += 1
    now = sum(abs(ppp[i] - xxx[i]) for i in range(3))
    now += 10*sum(0 if cnt[i]==0 else cnt[i]-1 for i in range(3))
    res = min(res, now)
print(res)
