n,A,B,C=map(int,input().split())
L=[int(input()) for i in range(n)]
INF=10**9

def dfs(cnt,a,b,c):
  if cnt==n:
    if min(a,b,c)>0:
      return abs(A-a)+abs(B-b)+abs(C-c)-30
    else:
      return  INF
  else:
    res0=dfs(cnt+1,a,b,c)
    res1=dfs(cnt+1,a+L[cnt],b,c)+10
    res2=dfs(cnt+1,a,b+L[cnt],c)+10
    res3=dfs(cnt+1,a,b,c+L[cnt])+10
    return min(res0,res1,res2,res3)

print(dfs(0,0,0,0))
    