


import math

import qiskit



def       _lowerCAmelCase    (				lowerCAmelCase_				:int = 1		,    lowerCAmelCase_				:int = 1		,    lowerCAmelCase_				:int = 1				)->qiskit.result.counts.Counts:
   '''simple docstring'''






   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
   snake_case_            =       qiskit.QuantumRegister(4		,    "qr"				)
   snake_case_            =       qiskit.ClassicalRegister(2		,    "cr"				)
   # list the entries
   snake_case_            =       [input_a, input_a, carry_in]

   snake_case_            =       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

   snake_case_            =       qiskit.Aer.get_backend("aer_simulator"				)
   snake_case_            =       qiskit.execute(lowerCAmelCase_		,    lowerCAmelCase_		,    shots=1_000				)

   return job.result().get_counts(lowerCAmelCase_				)


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








def       _lowerCAmelCase    (				lowerCAmelCase_				:List[str]		,    lowerCAmelCase_				:int				)->Optional[int]:
   '''simple docstring'''






   snake_case_            =       0
   while b > 0:
      if b & 1:
         res += a

      a += a
      b >>= 1

   return res



def       _lowerCAmelCase    (				lowerCAmelCase_				:int		,    lowerCAmelCase_				:List[str]		,    lowerCAmelCase_				:Dict				)->Dict:
   '''simple docstring'''






   snake_case_            =       0
   while b > 0:
      if b & 1:
         snake_case_            =       ((res % c) + (a % c)) % c

      a += a
      b >>= 1

   return res




