def __init__(
        self, identifier: str, target: Sequence[int], inputs: Sequence[Sequence[int] | int]
    ):
        """Inits QuirkArithmeticGate.

        Args:
            identifier: The quirk identifier string for this operation.
            target: The target qubit register.
            inputs: Qubit registers, which correspond to the qid shape of the
                qubits from which the input will be read, or classical
                constants, that determine what happens to the target.

        Raises:
            ValueError: If the target is too small for a modular operation with
                too small modulus.
        """
        self.identifier = identifier
        self.target: tuple[int, ...] = tuple(target)
        self.inputs: tuple[Sequence[int] | int, ...] = tuple(
            e if isinstance(e, int) else tuple(e) for e in inputs
        )

        if self.operation.is_modular:
            r = inputs[-1]
            if isinstance(r, int):
                over = r > 1 << len(target)
            else:
                over = len(cast(Sequence, r)) > len(target)
            if over:
                raise ValueError(f'Target too small for modulus.\nTarget: {target}\nModulus: {r}')
Inits QuirkArithmeticGate.

        Args:
            identifier: The quirk identifier string for this operation.
            target: The target qubit register.
            inputs: Qubit registers, which correspond to the qid shape of the
                qubits from which the input will be read, or classical
                constants, that determine what happens to the target.

        Raises:
            ValueError: If the target is too small for a modular operation with
                too small modulus.
        
cirq-core/cirq/interop/quirk/cells/arithmetic_cells.py