from bisect import *
from collections import *
from fractions import gcd
from math import factorial
from itertools import *
N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]
value=10**10
itelst=[list(permutations(L,i)) for i in range(3,N+1)]
for a,b,c in list(permutations([A,B,C])):
    for n in range(N-2):
        for lst in itelst[n]:
            for i1 in range(1,len(lst)-1):
                for i2 in range(i1+1,len(lst)):
                    value=min(value, (len(lst)-3)*10+\
                            round(abs(a-sum(lst[  :i1])))+\
                            round(abs(b-sum(lst[i1:i2])))+\
                            round(abs(c-sum(lst[i2:  ]))))

print(value)
