What is the cost (number of gates) of $\sum_{i=0}^{N-1}| i \rangle \langle i|\otimes U_i$ in terms of $N$ and the costs of the unitaries $U_i$? Say the gate set consists of arbitrary one-qubit gates and the CNOT. The unitaries $U_i$ act on an arbitrary number of qubits.
I know, for example, that the Toffoli gate, which is of the above form with $N=4$ and $U_3=X$, can be constructed with $6$ CNOTs.