N,A,B,C=map(int,input().split())
L=[int(input()) for i in range(N)]
INF=10**8
def dfs(n,a,b,c):
  #n:n番目の竹までをみる
  #a:Aに使う竹の合計
  #b:Bに使う竹の合計
  #c:Cに使う竹の合計
  if n==N:
    if a*b*c>0:
      ret=abs(A-a)+abs(B-b)+abs(C-c)-30
    else:
      ret=INF
  else:
    ret=dfs(n+1,a,b,c)
    reta=dfs(n+1,a+L[n],b,c)+10
    retb=dfs(n+1,a,b+L[n],c)+10
    retc=dfs(n+1,a,b,c+L[n])+10
    ret = min(ret,reta,retb,retc)
  return ret
print(dfs(0,0,0,0))
