




import math

import qiskit

def    UpperCAmelCase_				( __UpperCAmelCase		:      int = 1     ,     __UpperCAmelCase		:      int = 1     ,     __UpperCAmelCase		:      int = 1				)   ->					qiskit.result.counts.Counts:
      if (
          isinstance(__UpperCAmelCase     ,     __UpperCAmelCase				)
          or isinstance(__UpperCAmelCase     ,     __UpperCAmelCase				)
          or isinstance(__UpperCAmelCase     ,     __UpperCAmelCase				)
      ):
            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(__UpperCAmelCase				) != input_a)
          or (math.floor(__UpperCAmelCase				) != input_a)
          or (math.floor(__UpperCAmelCase				) != 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
      SCREAMING_SNAKE_CASE_      		=     qiskit.QuantumRegister(4     ,     'qr'				)
      SCREAMING_SNAKE_CASE_      		=     qiskit.ClassicalRegister(2     ,     'cr'				)
      # list the entries
      SCREAMING_SNAKE_CASE_      		=     [input_a, input_a, carry_in]

      SCREAMING_SNAKE_CASE_      		=     qiskit.QuantumCircuit(__UpperCAmelCase     ,     __UpperCAmelCase				)

      for i in range(0     ,     3				):
            if entry[i] == 2:
                  quantum_circuit.h(__UpperCAmelCase				)  # for hadamard entries
            elif entry[i] == 1:
                  quantum_circuit.x(__UpperCAmelCase				)  # for 1 entries
            elif entry[i] == 0:
                  quantum_circuit.i(__UpperCAmelCase				)  # 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]     ,     __UpperCAmelCase				)  # measure the last two qbits

      SCREAMING_SNAKE_CASE_      		=     qiskit.Aer.get_backend('aer_simulator'				)
      SCREAMING_SNAKE_CASE_      		=     qiskit.execute(__UpperCAmelCase     ,     __UpperCAmelCase     ,     shots=10_00				)

      return job.result().get_counts(__UpperCAmelCase				)


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





from __future__ import annotations

from collections.abc import Generator

def    UpperCAmelCase_				( )   ->					Generator[int, None, None]:
      SCREAMING_SNAKE_CASE_      		=     {}
      SCREAMING_SNAKE_CASE_      		=     2
      while True:
            SCREAMING_SNAKE_CASE_      		=     factor_map.pop(__UpperCAmelCase     ,     __UpperCAmelCase				)
            if factor:
                  SCREAMING_SNAKE_CASE_      		=     factor + prime
                  while x in factor_map:
                        x += factor
                  SCREAMING_SNAKE_CASE_      		=     factor
            else:
                  SCREAMING_SNAKE_CASE_      		=     prime
                  yield prime
            prime += 1

def    UpperCAmelCase_				( __UpperCAmelCase		:      float = 1E10				)   ->					int:
      SCREAMING_SNAKE_CASE_      		=     sieve()

      SCREAMING_SNAKE_CASE_      		=     1
      while True:
            SCREAMING_SNAKE_CASE_      		=     next(__UpperCAmelCase				)
            if (2 * prime * n) > limit:
                  return n
            # Ignore the next prime as the reminder will be 2.
            next(__UpperCAmelCase				)
            n += 2


if __name__ == "__main__":
   print(solution())