N,A,B,C=map(int,input().split())
l_list=[int(input())for _ in range(N)]

def dfs(now,a,b,c):
  if now==N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else float ("inf")
  res0 =dfs(now+1,a,b,c)
  res1=dfs(now+1,a+l_list[now],b,c)+10
  res2=dfs(now+1,a,b+l_list[now],c)+10
  res3=dfs(now+1,a,b,c+l_list[now])+10
  return min(res0,res1,res2,res3)

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

