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

def f(a,b,c,k):
    if k == N:
        if not a or not b or not c:
            return 10**9
        return abs(a-A)+abs(b-B)+abs(c-C)-30
    ans0 = f(a,b,c,k+1)
    ans1 = f(a+L[k],b,c,k+1)+10
    ans2 = f(a,b+L[k],c,k+1)+10
    ans3 = f(a,b,c+L[k],k+1)+10
    return min(ans0,ans1,ans2,ans3)

print(f(0,0,0,0))