n,a,b,c=map(int, input().split())
x=[int(input()) for i in range(n)]
from itertools import product
z=[a,b,c]
d=[0,1,2,3]
ans=10**8
for i in product(d,repeat=n):
    an=0
    y=[[],[],[],[]]
    for j,k in enumerate(i):
        y[k].append(x[j])
    if len(y[1])==0 or len(y[2])==0 or len(y[3])==0:continue
    for k,j in enumerate(y[1:]):
        an+=(len(j)-1)*10+abs(sum(j)-z[k])
    ans=min(an,ans)
print(ans)