
n,A,B,C = map(int, input().split()) 

ls = [int(input()) for _ in range(n)]

inf = 10000

def dfs(i,a,b,c):
    if i == n:
        return \
            inf if min(a,b,c) == 0 \
            else abs(A-a) + abs(B-b)+abs(C-c)-30
    
    i1 = i+1
    lsi = ls[i]

    r0 = dfs(i1, a,b,c)
    r1 = dfs(i1, a+lsi,b,c) + 10
    r2 = dfs(i1, a,b+lsi,c) + 10
    r3 = dfs(i1, a,b,c+lsi) + 10

    return min(r0,r1,r2,r3)

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