n,a,b,c=map(int,input().split())
l=[int(input())for i in range(n)]
def dfs(i,x,y,z):
 if i==n:return abs(a-x)+abs(b-y)+abs(c-z)-30if a+b+c>=3else 10**9+7
 A,B,C,D=dfs(i+1,x,y,z),dfs(i+1,x+l[i],y,z)+10,dfs(i+1,x,y+l[i],z)+10,dfs(i+1,x,y,z+l[i])+10
 return min(A,B,C,D)
print(dfs(0,0,0,0))