# review
N,A,B,C = map(int,input().split())
L = [int(input()) for _ in range(N)]
 
def f(i,a,b,c):
    if i == N:
        if min(a, b, c) <= 0:
            return 10**9
        return abs(a-A)+abs(b-B)+abs(c-C)-30
    costx = f(i+1,a,b,c)
    costA = f(i+1,a+L[i],b,c)+10
    costB = f(i+1,a,b+L[i],c)+10
    costC = f(i+1,a,b,c+L[i])+10
    return min(costx,costA,costB,costC)
 
print(f(0,0,0,0))