import sys
sys.setrecursionlimit(10**9)

def search(arr,arr2,cost,flag):
  global mincost
  if cost>mincost:
    return 0
  if flag==0:
    if len(arr2)==0:
      ans.add(cost)
      if mincost>cost:
        mincost=cost
      return 0
    tmp=10**9
    tpos=0
    for i in range(len(arr)):
      if tmp>cost+abs(arr2[0]-arr[i]):
        tmp=cost+abs(arr2[0]-arr[i])
        tpos=i
    search(arr[:tpos]+arr[tpos+1:],arr2[1:],tmp,0)
  else:
    if len(arr)>=len(arr2)+1:
      for i in range(len(arr)):
        for j in range(i+1,len(arr)):
          search(arr[:i]+arr[i+1:j]+arr[j+1:]+[arr[i]+arr[j]],arr2,cost+10,0)
          search(arr[:i]+arr[i+1:j]+arr[j+1:]+[arr[i]+arr[j]],arr2,cost+10,1)

n,a,b,c=map(int,input().split())
arr=[int(input()) for _ in range(n)]
arr2=[a,b,c]
ans=set()
mincost=10**9

search(arr,arr2,0,0)
search(arr,arr2,0,1)

ans=sorted(list(ans))
print(ans[0])