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

def dfs(index, a, b, c):
    if index == N:
        return abs(a-A)+abs(b-B)+abs(c+C)-30 if min(a, b, c) > 0 else float('inf')
    
    val1 = dfs(index+1, a, b, c)
    val2 = dfs(index+1, a+l[index], b, c) + 10
    val3 = dfs(index+1, a, b+l[index], c) + 10
    val4 = dfs(index+1, a, b, c+l[index]) + 10
    return min(val1, val2, val3, val4)

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