import itertools

n,a,b,c=map(int,input().split())
l0=[a,b,c]
l0.sort()
l02=l0[:]
l02.reverse()
l=[]
for i in range(n):
  x=int(input())
  if l0.count(x)>0:
    l0.remove(x)
  else:
    l.append(x)
if len(l0)==0:
  print(0)
  exit()
l.sort()
ll=l[:]

cst1=0
l2=[]
for i in l0:
  if i<l[0]:
    cst1=l[0]-i
    l.remove(l[0])
  else:
    p=100000000000000
    r=[]
    for j in range(1,len(l)+1):
      for k in list(itertools.combinations(l,j)):
        q=abs(i-sum(k))+(j-1)*10
        if q<p:
          p=q
          r=k
    l2.append(tuple([r,p]))
    for j in r:
      l.remove(j)
for i in l2:
  cst1+=i[1]

cst2=0
l2=[]
for i in l02:
  if len(ll)>0 and i<ll[0]:
    cst2=ll[0]-i
    ll.remove(ll[0])
  else:
    p=100000000000000
    r=[]
    for j in range(1,len(ll)+1):
      for k in list(itertools.combinations(ll,j)):
        q=abs(i-sum(k))+(j-1)*10
        if q<p:
          p=q
          r=k
    l2.append(tuple([r,p]))
    for j in r:
      ll.remove(j)
for i in l2:
  cst2+=i[1]
print(cst1,cst2)
print(min(cst1,cst2))