n, a, b, c = map(int, input().split())
bum = []
bum.append(a)
bum.append(b)
bum.append(c)


l = []
sum = 0

for _ in range(n):
  l.append(input())
  
l = [int(i) for i in l]
l.sort(reverse = True)

for x in bum:
  for i in l:
    for j in l:
      if x>i and x==(i+j) and i!=j and (x-i)>10:
        sum += 10
        l.remove(j)
        
      else:
        sum += abs(x-i)
    l.remove(i)
        
      
print(sum)