


'''simple docstring'''
import math

import qiskit





def 					a__       (					lowerCAmelCase__ = 1  ,					lowerCAmelCase__ = 1  ,					lowerCAmelCase__ = 1						)    ->	qiskit.result.counts.Counts:
    if (
        isinstance(lowerCAmelCase__  ,					lowerCAmelCase__						)
        or isinstance(lowerCAmelCase__  ,					lowerCAmelCase__						)
        or isinstance(lowerCAmelCase__  ,					lowerCAmelCase__						)
    ):
        raise TypeError('''inputs must be integers.'''						)

    if (input_a < 0) or (input_a < 0) or (carry_in < 0):
        raise ValueError('''inputs must be positive.'''						)

    if (
        (math.floor(lowerCAmelCase__						) != input_a)
        or (math.floor(lowerCAmelCase__						) != input_a)
        or (math.floor(lowerCAmelCase__						) != carry_in)
    ):
        raise ValueError('''inputs must be exact integers.'''						)

    if (input_a > 2) or (input_a > 2) or (carry_in > 2):
        raise ValueError('''inputs must be less or equal to 2.'''						)

    # build registers
    UpperCAmelCase__			:		Union[str, Any]													=				qiskit.QuantumRegister(4  ,					'''qr'''						)
    UpperCAmelCase__			:		Tuple													=				qiskit.ClassicalRegister(2  ,					'''cr'''						)
    # list the entries
    UpperCAmelCase__			:		Any													=				[input_a, input_a, carry_in]

    UpperCAmelCase__			:		int													=				qiskit.QuantumCircuit(lowerCAmelCase__  ,					lowerCAmelCase__						)

    for i in range(0  ,					3						):
        if entry[i] == 2:
            quantum_circuit.h(lowerCAmelCase__						)  # for hadamard entries
        elif entry[i] == 1:
            quantum_circuit.x(lowerCAmelCase__						)  # for 1 entries
        elif entry[i] == 0:
            quantum_circuit.i(lowerCAmelCase__						)  # for 0 entries

    # build the circuit
    quantum_circuit.ccx(0  ,					1  ,					3						)  # ccx = toffoli gate
    quantum_circuit.cx(0  ,					1						)
    quantum_circuit.ccx(1  ,					2  ,					3						)
    quantum_circuit.cx(1  ,					2						)
    quantum_circuit.cx(0  ,					1						)

    quantum_circuit.measure([2, 3]  ,					lowerCAmelCase__						)  # measure the last two qbits

    UpperCAmelCase__			:		List[str]													=				qiskit.Aer.get_backend('''aer_simulator'''						)
    UpperCAmelCase__			:		List[str]													=				qiskit.execute(lowerCAmelCase__  ,					lowerCAmelCase__  ,					shots=10_00						)

    return job.result().get_counts(lowerCAmelCase__						)


if __name__ == "__main__":
  print(F"""Total sum count for state is: {quantum_full_adder(1, 1, 1)}""")




'''simple docstring'''
def 					a__       (					lowerCAmelCase__						)    ->	int:
    UpperCAmelCase__			:		Tuple													=				0
    while num > 0:
        digit_sum += num % 10
        num //= 10
    return digit_sum





def 					a__       (					lowerCAmelCase__ = 1_00						)    ->	int:
    UpperCAmelCase__			:		Dict													=				1
    UpperCAmelCase__			:		str													=				2

    for i in range(2  ,					max_n + 1						):
        UpperCAmelCase__			:		Tuple													=				pre_numerator
        UpperCAmelCase__			:		Tuple													=				2 * i // 3 if i % 3 == 0 else 1
        UpperCAmelCase__			:		str													=				cur_numerator
        UpperCAmelCase__			:		List[str]													=				e_cont * pre_numerator + temp

    return sum_digits(lowerCAmelCase__						)


if __name__ == "__main__":
  print(F"""{solution() = }""")
