def rec(A, B, C, L, mp):
    N = len(L)
    ret = 1e18
    
    for i in range(N):
        for j in range(N):
            for k in range(N):
                if i == j or j == k or k == i:
                    continue
                
                ret = min(ret, mp + abs(A - L[i]) + abs(B - L[j]) + abs(C - L[k]))

    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            
            newL = [l for k, l in enumerate(L) if k != i and k != j]
            newL.append(L[i] + L[j])
            ret = min(ret, rec(A, B, C, newL, mp + 10))
    
    return ret

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

print(rec(A, B, C, L, 0))