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

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