n,a,b,c=map(int,input().split())
length=[]
point=0
for i in range(n):
  k=int(input())
  length.append(k)
length=sorted(length)
def mp_1(k):
  length_1=0
  ans=11
  for i in length:
    if k-10<=i<=k+10:
      if abs(k-i)<ans:
        length=i
    if length_1 in length:
      length.remove(length_1)
    return ans
def mp_2(k):
  count=0
  for i in length:
    if k>length:
      count=1
      break
    else:
      pass
  if count!=0:
    return 0
  else:
    return 1
def mp_3(k):
  map=[]
  for i in length:
    if k>length:
      map.append(length)
    else:
      pass
    return map
for i in [c,b,a]:
  if mp_1(i)!=11:
    point+=mp_1
  elif mp_2(i)==1:
    point+=abs(k-length.pop(0))
  else:
    for i in mp_3(i):
      for m in mp_3(i).pop(index(i)):
        if i+m==k:
          point+=10
print(point)