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


def dfs(cur, a, b, c):
    if cur == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) else 1000000000

    path_null = dfs(cur+1, a, b, c)
    path_a = dfs(cur+1, a+L[cur], b, c) + 10
    path_b = dfs(cur+1, a, b+L[cur], c) + 10
    path_c = dfs(cur+1, a, b, c+L[cur]) + 10

    return min(path_null, path_a, path_b, path_c)

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