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

def dfs(num,a,b,c):
  if num == N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF
  ret0 = dfs(num+1,a,b,c)
  ret1 = dfs(num+1,a+take[num],b,c) + 10
  ret2 = dfs(num+1,a,b+take[num],c) + 10
  ret3 = dfs(num+1,a,b,c+take[num]) + 10
  return min(ret0,ret1,ret2,ret3)

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