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

def dfs(i, a, b, c):
    if i == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    
    tmp0 = dfs(i + 1, a, b, c)
    tmpa = dfs(i + 1, a + L[i], b, c) + 10
    tmpb = dfs(i + 1, a, b + L[i], c) + 10
    tmpc = dfs(i + 1, a, b, c + L[i]) + 10
    ans = min(tmp0, tmpa, tmpb, tmpc)
    
    return ans

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